prabhat khadka

prabhat khadka

  • NA
  • 14
  • 21.6k

windows service help

Dec 19 2007 7:00 AM
I have developed a windows service.To run my service I must check the box containing "Allow System to interact with Desktop".Is it possible to check that box through programming.

Well I got this code..

RegistryKey ckey = Registry.LocalMachine.CreateSubKey(@"SYSTEM\CurrentControlSet\Services\"+ServiceName);
if (ckey != null)

if (ckey.GetValue("Type") != null)
ckey.SetValue("Type", ((int)ckey.GetValue("Type")|256));

The box is checked but not doing the desired task.But if I manually check that box again it does.And,Where should I put above method?
Thank u.