Making service to interact with desktop programmatically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pvenkatesh2k4
    New Member
    • Feb 2008
    • 18

    Making service to interact with desktop programmatically

    hi i am new to .net development,
    i have created a service which has forms to interact with user. now before starting the service , i need to change the property of service to interact with desktop.after installing i need to do this every time. to solve this issue i found a code that changes the value of service property.i have used this following code in afterinstall callback method()

    RegistryKey ckey = Registry.LocalM achine.OpenSubK ey(
    @"SYSTEM\Curren tControlSet\Ser vices\WindowsSe rvice1", true);
    // Good to always do error checking!

    if(ckey != null)
    {
    // Ok now lets make sure the "Type" value is there,

    //and then do our bitwise operation on it.

    if(ckey.GetValu e("Type") != null)
    {
    ckey.SetValue(" Type", ((int)ckey.GetV alue("Type") | 256));
    }
    }
    }



    this code changes the property as allow service to interact with desktop. but when i am starting the service forms are not shown....

    how to solve this issue?
    thanks in advance..
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Why not just make a gui application that talks to the service, and leave the service running as a service?

    Comment

    • pvenkatesh2k4
      New Member
      • Feb 2008
      • 18

      #3
      Originally posted by Plater
      Why not just make a gui application that talks to the service, and leave the service running as a service?
      if it is my own application then it is no problem to design that as Form;but it is different application like gateway. the service needs to run this application in on start.to start the application i included the code in onstart funcion; that gateway application requires user interaction. so inorder to do that i need the service interact desktop property needs to be set.

      Comment

      Working...