Prev: query remaining Stack Size
Next: How do I assign 'logon as service' privilege on Vista Home / Home Premium? (CreateProcessAsUser())
From: Dansk on 17 May 2007 11:37 Hi all, I start a process using ShellExecuteEx and I get the process handle. I also need the process ID, how can I get it ? Thanks in advance, Dansk.
From: Elcaro Nosille on 17 May 2007 11:43 Dansk schrieb: > Hi all, > I start a process using ShellExecuteEx and I get the process handle. > I also need the process ID, how can I get it ? processId = GetProcessId( hProcess ) ?
From: Dansk on 18 May 2007 09:21 Good catch, this was an easy one. (http://msdn2.microsoft.com/en-us/library/ms683215.aspx) More challenging : How can I get the process Id from its handle on systems prior to winXP sp1 ? Thanks in advance, Dansk. Elcaro Nosille wrote : > Dansk schrieb: > >> Hi all, >> I start a process using ShellExecuteEx and I get the process handle. >> I also need the process ID, how can I get it ? > > processId = GetProcessId( hProcess ) > ?
From: Gary Chanson on 18 May 2007 09:42 Do you really need to use ShellExecuteEx? If you use CreateProcess, it returns the process ID as one of the elements of lpProcessInformation. -- - Gary Chanson (Windows SDK MVP) - Abolish Public Schools "Dansk" <dansk(a)laouilest.com> wrote in message news:#boXp9UmHHA.4624(a)TK2MSFTNGP04.phx.gbl... > Good catch, this was an easy one. > (http://msdn2.microsoft.com/en-us/library/ms683215.aspx) > > More challenging : > How can I get the process Id from its handle on systems prior to winXP sp1 ? > > Thanks in advance, > Dansk. > > Elcaro Nosille wrote : > > Dansk schrieb: > > > >> Hi all, > >> I start a process using ShellExecuteEx and I get the process handle. > >> I also need the process ID, how can I get it ? > > > > processId = GetProcessId( hProcess ) > > ?
From: James Brown on 18 May 2007 17:55
"Dansk" <dansk(a)laouilest.com> wrote in message news:%23boXp9UmHHA.4624(a)TK2MSFTNGP04.phx.gbl... > Good catch, this was an easy one. > (http://msdn2.microsoft.com/en-us/library/ms683215.aspx) > > More challenging : > How can I get the process Id from its handle on systems prior to winXP sp1 > ? > > Thanks in advance, > Dansk. > > Elcaro Nosille wrote : >> Dansk schrieb: >> >>> Hi all, >>> I start a process using ShellExecuteEx and I get the process handle. >>> I also need the process ID, how can I get it ? >> >> processId = GetProcessId( hProcess ) >> ? > On NT-based systems use the ZwQueryInformationProcess native API see: www.catch22.net/tuts/tips2.asp for an example -- James Brown Microsoft MVP - Windows SDK www.catch22.net Free Win32 Tutorials and Sourcecode |