Unable to properly set the InteractiveProcess property on a windows service
- From: letibal@xxxxxxxxx
- Date: 7 Apr 2006 02:53:50 -0700
Hello,
I have written a windows service and created an installer for it.
The service runs under the system accounts. When started, it launches a
GUI.
By default, the InteractiveProcess property of the service is not set
(this can be checked by right-clicking on the service in the Services
window (Admin tools>Services), choosing Properties, LogOn tab). In
order to enable my service to launch a GUI at startup, I added the
following lines in my installer :
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
SetInteractWithDesktop();
}
private void SetInteractWithDesktop()
{
RegistryKey fm;
ServiceType type;
fm =
Registry.LocalMachine.OpenSubKey(@"SYSTEM\CURRENTCONTROLSET\SERVICES\myserv",
true);
type = ServiceType.InteractiveProcess |
ServiceType.Win32OwnProcess;
fm.SetValue("Type", (int)type);
fm.Close();
}
This modifies the appropriate Registry key in order to enable the
InteractiveProcess property.
If I install this service and run it : it does not display my GUI.
However, if I check in Admin tools>Services>*myserv*Properties>LogOn
tab, I can see the box ticked for "Allow service to interact with
Desktop", which is the expected behavior.
Now if I untick and tick again this box, press ok, and start my
service, it works fine, displaying the GUI correctly.
I'm wondering whether the registry key Im changing when installing the
service, is the only one to be changed in order to enable interaction
with the desktop.
Any ideas that could help me ?
Cheers,
Tibo
.
- Follow-Ups:
- Prev by Date: Is it possible to use inheritance here or some other construction to make the code less
- Next by Date: Re: Permissions for Updater Application Block
- Previous by thread: Is it possible to use inheritance here or some other construction to make the code less
- Next by thread: Re: Unable to properly set the InteractiveProcess property on a windows service
- Index(es):
Relevant Pages
|