Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to chnage to a process startet with CreatProcess()

Status
Not open for further replies.

RiCOtakayama

Programmer
May 26, 1999
8
0
0
DE
I have a problem i want to change from my programm to another process started with CreatProcess().<br>
<br>
I tried to use SetFocus() but i need the HWND of the process... but i havent one... so perhaps you can tell me how i can get the HWND<br>
<br>
thanks<br>
<br>
RiCO
 
The CreateProcess() API will fill in an LPPROCESS_INFORMATION structure for you. The hProcess member contains the handle of the process, you can pass that to SetFocus().<br>
<br>
Here is an LPPROCESS_INFORMATION structure:<br>
typedef struct _PROCESS_INFORMATION {<br>
HANDLE hProcess; <br>
HANDLE hThread; <br>
DWORD dwProcessId; <br>
DWORD dwThreadId; <br>
} <br>
<br>
The actual CreateProcess invocation (in VC++ 5.0) is:<br>
BOOL CreateProcess(LPCTSTR lpApplicationName, <br>
LPTSTR lpCommandLine, <br>
LPSECURITY_ATTRIBUTES lpProcessAttributes, <br>
LPSECURITY_ATTRIBUTES lpThreadAttributes, <br>
BOOL bInheritHandles, <br>
DWORD dwCreationFlags, <br>
LPVOID lpEnvironment, <br>
LPCTSTR lpCurrentDirectory, <br>
LPSTARTUPINFO lpStartupInfo, <br>
LPPROCESS_INFORMATION lpProcessInformation); <br>
<br>
Good Luck!<br>
<br>
Pat Gleason<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top