Windows API - Controlling other windows
Hello dearest fellow prorammers (if I may call myself one),
I am trying to open a program with another program, using ShellExecute, this ShellExecute hands me a HINSTANCE of the started program. However I want to have the HWND of this program, I tried using functions such as:
GetWindow();
Handing it either my own hwnd, or the desktop hwnd, using all the possible GW_ flags, but the best I could get was shutting down windows when trying to send WM_CLOSE.
Can anyone tell me a surefire way of getting the right HWND of the program I started, so I can use:
PostMessage();
To send it WM_ commands.
(I need to fool a windows program into thinking its being used by a normal user, while my program provides all the input).
Thankyou very much for all your attention!