HWND from hProcess
-
Hi all, I have dll(mfc) which displays dialog with list control with some file [with path] ( .doc,.msg, ... ) When user double clicks my code opens file in maximize mode useing ShellExecuteEx. It returns me HANDLE hProcess. All works fine. But some file like msg file are not opening in MAXIMIZE state. After looking deep into that i conclude that it is handled by MS Outlook.( means if last msg file is opend in normal window (not maximized) then my code will not open msg file maximized!!.) So what i want is HWND from hProcess. so that i can send message to that window for maximize!!! I have searched a lot and also applied a code. but i think my dll handles this so i m not getting required results. //////////////////////////////////// hProcess is returned by ShellExecuteEx WaitForInputIdle(hProcess,1000); FILETIME lpCreationTime, lpCreationTime2; FILETIME d1,d2,d3; DWORD dwProcessId; HANDLE hProc; GetProcessTimes( hProcess, &lpCreationTime, &d1, &d2, &d3 ); HWND hTemp = ::FindWindow(NULL,NULL); while ( hTemp != NULL ) { if ( ::GetParent(hTemp) == NULL ) { ::GetWindowThreadProcessId(hTemp,&dwProcessId); hProc = OpenProcess(PROCESS_QUERY_INFORMATION, 0, dwProcessId); GetProcessTimes( hProc, &lpCreationTime2, &d1, &d2, &d3 ); CloseHandle(hProc); if ( lpCreationTime.dwHighDateTime == lpCreationTime2.dwHighDateTime && lpCreationTime.dwLowDateTime == lpCreationTime2.dwLowDateTime ) { //("Sending Message"); // Never came here ::PostMessage(hTemp,WM_SYSCOMMAND,SC_MAXIMIZE,0); break; } } hTemp = ::GetWindow(hTemp, GW_HWNDNEXT) ; //"looping"); } // i have also tried with EnumWindows and its proc. Can anyone help me in getting solved my problem. Thank in advance. Regards Jetli Constant Thing In World Is Change.