Creating A Windows Service...HELP!
-
I have a .NET DLL that contains two forms. This DLL works great from windows applications. But when I make a windows service that references the DLL the forms do not show, the form code executes without any errors but no forms are displayed. Does anyone know how to get this to work?
-
I have a .NET DLL that contains two forms. This DLL works great from windows applications. But when I make a windows service that references the DLL the forms do not show, the form code executes without any errors but no forms are displayed. Does anyone know how to get this to work?
I could be mistaken on this, but normally a service does not have any user interface, and the service framework may, in fact, prohibit any UI from displaying properly... though I would expect it throw an error in that case. If you want to run the code as a service, separate the UI and the logic into separate assemblies, then use the UI as an observer of the state of the service?
-
I have a .NET DLL that contains two forms. This DLL works great from windows applications. But when I make a windows service that references the DLL the forms do not show, the form code executes without any errors but no forms are displayed. Does anyone know how to get this to work?
OK. In general: Windows Services run in their own Windows sessions. What does this mean? Well, when you login to Windows, you start your own session. Services do the same thing. They get their own Window Station, Desktop, Environment, and such. This means that the user interface your app is putting is showing up, but it's on a desktop that you can't see. There is no way to view the session of a service! Services cannot interact with the user session directly (or easily.) But, it IS possible to write a service that interacts with the users desktop. Your going to have to supply the service with the logged on users security context, station handle, and desktop handle, at a minimum. Hint: Your going to have to write a seperate app that runs on the user side and communicates with the service via RPC to do this. Information on how this works (and why) can be found in the Platform SDK documentation. Just search for "Window Stations" (no S on the end of Window) on MSDN for a good starting point. RageInTheMachine9532
-
OK. In general: Windows Services run in their own Windows sessions. What does this mean? Well, when you login to Windows, you start your own session. Services do the same thing. They get their own Window Station, Desktop, Environment, and such. This means that the user interface your app is putting is showing up, but it's on a desktop that you can't see. There is no way to view the session of a service! Services cannot interact with the user session directly (or easily.) But, it IS possible to write a service that interacts with the users desktop. Your going to have to supply the service with the logged on users security context, station handle, and desktop handle, at a minimum. Hint: Your going to have to write a seperate app that runs on the user side and communicates with the service via RPC to do this. Information on how this works (and why) can be found in the Platform SDK documentation. Just search for "Window Stations" (no S on the end of Window) on MSDN for a good starting point. RageInTheMachine9532