Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. HWND from hProcess

HWND from hProcess

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jetli Jerry
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups