//for installation mode and service startup type
this.Installers.Clear();
_service = new ServiceInstaller();
_service.ServiceName = strServiceName;
_service.StartType = ServiceStartMode.Automatic;
_service.Description = "Communicates between Client and Server with acknowledgement on both sides";
this.Installers.Add(_service);
_serviceProcess = new ServiceProcessInstaller();
_serviceProcess.Account = ServiceAccount.LocalSystem;
this.Installers.Add(_serviceProcess);
//part2: code to automate the check box "Allow service to interact with desktop"
RegistryKey ckey = Registry.LocalMachine.OpenSubKey(
@"SYSTEM\CurrentControlSet\Services\VerizonClientServerWindowsService", true);
if (ckey != null)
{
// Make sure the "Type" value is there,
//and then do bitwise operation on it.
if (ckey.GetValue("Type") != null)
{
ckey.SetValue("Type", ((int)ckey.GetValue("Type") | 256));
}
}
//part3: code to start the service
var controller = new ServiceController(strServiceName);
controller.Start();
Case1: If I don't have part2 and part3, then I need to manually check the check box of "alllow to interact with desktop" and then start the service. In this case I am able to get my required output (able to display Form on desktop.)
Case2: If I include part2 and part3, it is installing, checking the check box and running the service fine.
But I am unable to get my required output(form on desktop) in this case.
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE