Calling a GUI in windows service

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

I am using VS.Net 2002 with windows 2000 advanced server and windows 2000
professional. I have a requirement to use windows service with a GUI.

I want to show my own User Interface(Dialog) to get user input, before
windows login screen. For that I have created a windows service, in the
onstart event of this service, I am calling a vb.net exe, which has windows
form. But it throws error bcoz of the form. I even tried by calling a vb.net
dll from windows service with a msgbox in the dll ,i am getting the same
problem.
During this error, the DEBUG points to the form in the code.

Can someone please suggest a solution.

TIA,
Gary
 
Hi Gary,
I want to show my own User Interface(Dialog) to get user input, before
windows login screen. For that I have created a windows service, in the
onstart event of this service, I am calling a vb.net exe, which has windows
form. But it throws error bcoz of the form. I even tried by calling a vb.net
dll from windows service with a msgbox in the dll ,i am getting the same
problem.
During this error, the DEBUG points to the form in the code.

I do believe that this will be a non-trivial issue, since the user desktop
(where forms like this get displayed) is not available until login. You'd
have to show the form on the Winlogon desktop (\WinSta0\WinLogon). For this
to happen, you'd have to alter the default manner in which Visual Basic
displays forms... or possibly by injecting a DLL which launches the form
into the WinLogon process space, and initing the form launch with the
correct STARTUPINFO structure (setting the lpdesktop field to
"WinSta0\\WinLogon").

It is possible that you can also P/Invoke the SwitchDesktop function in
User32.dll, but I don't know if you are starting your service process with
DESKTOP_SWITCHDESKTOP access...

Here is info on SwitchDesktop:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/switchdesktop.asp

Good luck,
-rory 8)
 
Back
Top