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. Linkage between App windows and Processes

Linkage between App windows and Processes

Scheduled Pinned Locked Moved C / C++ / MFC
5 Posts 3 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.
  • A Offline
    A Offline
    AJarrett
    wrote on last edited by
    #1

    I'm wondering if anyone knows of a reasonable way to jump from an Application Hwnd to an associated processID or vice cersa. I've found much information on enumerating either running applications (EnumWindows) or active processes (PSAPI EnumProcesses, for instance), but I can't see any way to get from a processID I'm interested in to its main window handle or from an application Hwnd to its processID (and from there to its loaded modules). Hopefully I've missed aomething obvious. Suggestions appreciated. AJ

    C R 2 Replies Last reply
    0
    • A AJarrett

      I'm wondering if anyone knows of a reasonable way to jump from an Application Hwnd to an associated processID or vice cersa. I've found much information on enumerating either running applications (EnumWindows) or active processes (PSAPI EnumProcesses, for instance), but I can't see any way to get from a processID I'm interested in to its main window handle or from an application Hwnd to its processID (and from there to its loaded modules). Hopefully I've missed aomething obvious. Suggestions appreciated. AJ

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      Have a look at GetWindowThreadProcessId API for the reverse operation, I don't know. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

      A 1 Reply Last reply
      0
      • C CPallini

        Have a look at GetWindowThreadProcessId API for the reverse operation, I don't know. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

        A Offline
        A Offline
        AJarrett
        wrote on last edited by
        #3

        DOH! Thanks much. I shall fume for a while over why MSDN has such retarded search capabilities that it couldn't produce this from looking for "processid" or "process identifier" or "GetWindow", but I'll get over it. It is in the Index if I'd looked there. P.S. Alfonso might just as well have been referring to Mr. Gates.

        C 1 Reply Last reply
        0
        • A AJarrett

          I'm wondering if anyone knows of a reasonable way to jump from an Application Hwnd to an associated processID or vice cersa. I've found much information on enumerating either running applications (EnumWindows) or active processes (PSAPI EnumProcesses, for instance), but I can't see any way to get from a processID I'm interested in to its main window handle or from an application Hwnd to its processID (and from there to its loaded modules). Hopefully I've missed aomething obvious. Suggestions appreciated. AJ

          R Offline
          R Offline
          Robert Kuster
          wrote on last edited by
          #4

          Hi. > I can't see any way to get from a processID I'm > interested in to its main window handle There is no direct way, but you could use a combination of EnumWindows and GetWindowThreadProcessId calls. There is a MSDN article discussing this issue: Get the Main Window, Get EXE Name[^] > .. or from an application Hwnd to its processID This one is trivial through the GetWindowThreadProcessId API.

          Kind Regards, Robert Kuster _________________ www.it.rkuster.com

          1 Reply Last reply
          0
          • A AJarrett

            DOH! Thanks much. I shall fume for a while over why MSDN has such retarded search capabilities that it couldn't produce this from looking for "processid" or "process identifier" or "GetWindow", but I'll get over it. It is in the Index if I'd looked there. P.S. Alfonso might just as well have been referring to Mr. Gates.

            C Offline
            C Offline
            CPallini
            wrote on last edited by
            #5

            AJarrett wrote:

            P.S. Alfonso might just as well have been referring to Mr. Gates

            I absolutely agree :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

            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