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. Can I get the handle of a window?

Can I get the handle of a window?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
6 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.
  • C Offline
    C Offline
    Chaos Lawful
    wrote on last edited by
    #1

    If I got the handle of a application instance, can I get all of its windows' handles? Please help me:confused: Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.

    T N 2 Replies Last reply
    0
    • C Chaos Lawful

      If I got the handle of a application instance, can I get all of its windows' handles? Please help me:confused: Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      Handle of application instance? The one passed to WinMain? Tomasz Sowinski -- http://www.shooltz.com

      C 1 Reply Last reply
      0
      • T Tomasz Sowinski

        Handle of application instance? The one passed to WinMain? Tomasz Sowinski -- http://www.shooltz.com

        C Offline
        C Offline
        Chaos Lawful
        wrote on last edited by
        #3

        Yes, it is. Can I get the handle? Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.

        T 1 Reply Last reply
        0
        • C Chaos Lawful

          If I got the handle of a application instance, can I get all of its windows' handles? Please help me:confused: Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.

          N Offline
          N Offline
          NormDroid
          wrote on last edited by
          #4

          EnumWindowsProc? Norm Almond Chief Technical Architect FS Walker Hughes Limited

          C 1 Reply Last reply
          0
          • N NormDroid

            EnumWindowsProc? Norm Almond Chief Technical Architect FS Walker Hughes Limited

            C Offline
            C Offline
            Chaos Lawful
            wrote on last edited by
            #5

            It works fine. Thank you very much!:) But I think enumeration's performance isn't very high. Are there any other solutions?:rolleyes: Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.

            1 Reply Last reply
            0
            • C Chaos Lawful

              Yes, it is. Can I get the handle? Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.

              T Offline
              T Offline
              Tomasz Sowinski
              wrote on last edited by
              #6

              Application instance handle will be useless; it's provided for backward compatibility (all processes see identical value). You'll have to get a process ID instead. Then, as Norm suggested, you should use EnumWindows. For each window call GetWindowThreadProcessId and compare the IDs. Note that this technique gives you handles of toplevel windows; if you want their child you'll have to use EnumChildWindows. Tomasz Sowinski -- http://www.shooltz.com

              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