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. Process window

Process window

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
2 Posts 2 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.
  • N Offline
    N Offline
    neliocc
    wrote on last edited by
    #1

    Hi everybody. When i get the list of processes ids, with the EnumProcess function, how i can get the window asociated with a process? For example, if i have the process id 08937 i want to call a function GetWindow(08937) and it gives me a handle to the asociated window (HWND)

    K 1 Reply Last reply
    0
    • N neliocc

      Hi everybody. When i get the list of processes ids, with the EnumProcess function, how i can get the window asociated with a process? For example, if i have the process id 08937 i want to call a function GetWindow(08937) and it gives me a handle to the asociated window (HWND)

      K Offline
      K Offline
      khan
      wrote on last edited by
      #2

      Processes may not have created windows, and processes may create many windows. You can loop through all the top level windows using EnumChildWindows() with the desktop window as the parent: GetDesktopWindow(). And use this function: DWORD GetWindowThreadProcessId(HWND hWnd,LPDWORD lpdwProcessId); Then compare lpdwProcessId with the list of ProcessIds from EnumProcesses. If it is in the list, then the HWND from the EnumChildWindows proc is what you need. Maybe someone else knows of a better approach, maybe one simple api function to do all this! this is this.

      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