CreateProcess not showing window
From: Vivek (v_mangal_at_hotmail.com)
Date: 09/24/04
- Next message: Hugo M. Ranea: "Re: CreateProcess not showing window"
- Previous message: Annie: "WMI"
- Next in thread: Hugo M. Ranea: "Re: CreateProcess not showing window"
- Reply: Hugo M. Ranea: "Re: CreateProcess not showing window"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 24 Sep 2004 14:34:27 -0700
Hello,
I am trying to create a process on a remote machine. I am able to
successfully do so but i cant get the process to show its window. I can see
it running in Task Manager. I have tried setting the processStartup
parameter to 1, 5 etc. but to no avail. Could someone help please?
Thanks
Vivek
Heres my code:
public bool StartProcessByName1(string ProcessName)
{
string Path = string.Format(@"\\{0}\root\cimv2",SystemName);
ManagementScope ms = new ManagementScope(Path);
ManagementPath ProcessMgmtpath = new ManagementPath( "Win32_Process");
ManagementClass processClass = new ManagementClass(ms,ProcessMgmtpath,null);
ManagementPath ProcessStartupMgmtpath = new
ManagementPath("Win32_ProcessStartup");
ManagementClass processStartupClass = new
ManagementClass(ms,ProcessStartupMgmtpath,null);
processStartupClass.SetPropertyValue("ShowWindow", 1);
ManagementBaseObject inParams = processClass.GetMethodParameters("Create");
inParams["CommandLine"] = ProcessName;
inParams["ProcessStartupInformation"] = processStartupClass;
ManagementBaseObject ReturnObj =
processClass.InvokeMethod("Create",inParams,null);
return (ReturnObj["returnValue"].ToString() == "0");
}
- Next message: Hugo M. Ranea: "Re: CreateProcess not showing window"
- Previous message: Annie: "WMI"
- Next in thread: Hugo M. Ranea: "Re: CreateProcess not showing window"
- Reply: Hugo M. Ranea: "Re: CreateProcess not showing window"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|