user2886374
user2886374

Reputation: 53

How to get HWND of new process created by CreateProcess

i am developing an App for windows that will start some third party executable files such as cmd, paint, notepad etc using CreateProcess function. I want the functionality to hide and show the window of these EXE programs using HWND or suggest any other solution...

Upvotes: 1

Views: 3175

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 598134

CreateProcess() does not return the HWND of the new process so you will have to find it manually. Use EnumWindows() and GetWindowThreadProcessId() to find HWNDs whose process/thread IDs match the same IDs that CreateProcess() returns in the PROCESS_INFORMATION struct. Once you have the HWNDs, you can use ShowWindow() to show/hide them as needed.

Upvotes: 1

Related Questions