I've run a small application from CreateProcess using WaitForInputIdle straight after but I can't seem to get the correct window handle for the newly created process via EnumWindows and GetWindowThreadProcessId, the .exe I run as a process looks like this:
101 DIALOGEX 0, 0, 333, 180
STYLE WS_POPUP
EXSTYLE WS_EX_TOOLWINDOW
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
FONT 8, "MS Sans Serif"
{
CONTROL "", 1012, EDIT, ES_CENTER | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE, 5, 38, 195, 11 , 0x00000020
CONTROL "", 1013, EDIT, ES_CENTER | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE, 6, 4, 195, 11 , 0x00000020
CONTROL "", 1011, EDIT, ES_CENTER | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE, 5, 21, 195, 11 , 0x00000020
}
I'm assuming '101' would be the main window so that would be the handle I get however GetDlgItem fails to retrieve the child windows with error 1400 (Invalid window handle) then trying ShowWindow with the found handle fails also.
Does anyone with any experience of this kind of thing know why I get a handle that's not for any known window?
Also I assumed the CreateProcess function would put the newly created process in the list of apps/processes running with the parent application in task manager but it put's it as a background process on it's own, how do I add the process to list of processes running from the parent application?