Hi,
I am using MS VC++ 6.0 and win32 APIs. I have created a process to some other application using Win32 API "CreateProcess" and was able to launch that applicaton. I was able to obatain the handle of the that process window with EnumWindows API. The first window is a logon dialog box and once the OK button is pressed another window is displayed. Since I have the handle to the first window, everything works fine. But now I need to get a window handle of the second window so I could perfom minimize, maximize etc fuctions on it.
Could some one please tell me how I can obtain the handle to the second window. Following is the code I use for my CALLBACK function for EnumWindows:
BOOL CALLBACK AppManager::EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
AppManager * pAppMgr = (AppManager*) lParam;
// Get the process id of this newly found window
DWORD pid=0;
GetWindowThreadProcessId(hwnd, &pid);
if (pid == pAppMgr->_instanceData.pi.dwProcessId) { // if this id and our id match save the handle
pAppMgr->_instanceData.hwndRootWindow = hwnd;
pAppMgr->_instanceData.launched = true;
return false; // false to stop enumeration since we've found our window
}
return true;
}
I really apprciate the help.
Thanks
GT
I am using MS VC++ 6.0 and win32 APIs. I have created a process to some other application using Win32 API "CreateProcess" and was able to launch that applicaton. I was able to obatain the handle of the that process window with EnumWindows API. The first window is a logon dialog box and once the OK button is pressed another window is displayed. Since I have the handle to the first window, everything works fine. But now I need to get a window handle of the second window so I could perfom minimize, maximize etc fuctions on it.
Could some one please tell me how I can obtain the handle to the second window. Following is the code I use for my CALLBACK function for EnumWindows:
BOOL CALLBACK AppManager::EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
AppManager * pAppMgr = (AppManager*) lParam;
// Get the process id of this newly found window
DWORD pid=0;
GetWindowThreadProcessId(hwnd, &pid);
if (pid == pAppMgr->_instanceData.pi.dwProcessId) { // if this id and our id match save the handle
pAppMgr->_instanceData.hwndRootWindow = hwnd;
pAppMgr->_instanceData.launched = true;
return false; // false to stop enumeration since we've found our window
}
return true;
}
I really apprciate the help.
Thanks
GT