can web service start exe file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bhim Prakash

    #1

    can web service start exe file

    Dear

    i have create a windows service. I want to execute hello.exe from windwos service. i try

    Code:
                ManagementClass processClass = new ManagementClass("Win32_Process");
                //Get an input parameters object for this method
                ManagementBaseObject inParams = processClass.GetMethodParameters("Create");
                //Fill in input parameter values
                inParams["CommandLine"] = "calc.exe";
                //Execute the method
                ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams, null);
    
    or
    
                ProcessStartInfo startinfo = new ProcessStartInfo();
                startinfo.CreateNoWindow = false;
                startinfo.UseShellExecute = false;
                startinfo.RedirectStandardError = true;
                startinfo.RedirectStandardInput = true;
                startinfo.FileName = "C:/abc.exe";
                startinfo.WorkingDirectory = "C:/";
                startinfo.WindowStyle = ProcessWindowStyle.Normal;
    its both are run hello.exe find. its can't show any form display. but i check on taskbar hello.exe run under System User Name.

    Please help me, i how to display hello.exe form from windows service.

    Thank in advance.

    Bhim Prakash Singh
    Last edited by Atli; Oct 25 '10, 12:21 PM. Reason: Please use [code] tags when posting code, and don't post private contact info in the Answers forums.
Working...