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. about GetWindow function

about GetWindow function

Scheduled Pinned Locked Moved C / C++ / MFC
visual-studiocomquestion
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.
  • X Offline
    X Offline
    xrg_soft 163 com
    wrote on last edited by
    #1

    Hello, In the MSDN, GetWindow function page(http://msdn.microsoft.com/en-us/library/windows/desktop/ms633515(v=vs.85).aspx[^]), Remark section, it's said: "The EnumChildWindows function is more reliable than calling GetWindow in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed." Does anybody know in which case will the risks(caught in an infinite loop or referencing a handle to a window that has been destroyed) happen? Thanks & BR

    C T 2 Replies Last reply
    0
    • X xrg_soft 163 com

      Hello, In the MSDN, GetWindow function page(http://msdn.microsoft.com/en-us/library/windows/desktop/ms633515(v=vs.85).aspx[^]), Remark section, it's said: "The EnumChildWindows function is more reliable than calling GetWindow in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed." Does anybody know in which case will the risks(caught in an infinite loop or referencing a handle to a window that has been destroyed) happen? Thanks & BR

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      the answer to part of your question is on the page for EnumChildWindows:

      A child window that is moved or repositioned in the Z order during the enumeration process will be properly enumerated. The function does not enumerate a child window that is destroyed before being enumerated or that is created during the enumeration process.

      image processing toolkits | batch image processing

      X 1 Reply Last reply
      0
      • X xrg_soft 163 com

        Hello, In the MSDN, GetWindow function page(http://msdn.microsoft.com/en-us/library/windows/desktop/ms633515(v=vs.85).aspx[^]), Remark section, it's said: "The EnumChildWindows function is more reliable than calling GetWindow in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed." Does anybody know in which case will the risks(caught in an infinite loop or referencing a handle to a window that has been destroyed) happen? Thanks & BR

        T Offline
        T Offline
        ThatsAlok
        wrote on last edited by
        #3

        xrg_soft@163.com wrote:

        Does anybody know in which case will the risks(caught in an infinite loop or referencing a handle to a window that has been destroyed) happen?

        Any specific reason to use GetWindow instead of EnumChildWindows?

        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
        Never mind - my own stupidity is the source of every "problem" - Mixture

        cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

        X 1 Reply Last reply
        0
        • C Chris Losinger

          the answer to part of your question is on the page for EnumChildWindows:

          A child window that is moved or repositioned in the Z order during the enumeration process will be properly enumerated. The function does not enumerate a child window that is destroyed before being enumerated or that is created during the enumeration process.

          image processing toolkits | batch image processing

          X Offline
          X Offline
          xrg_soft 163 com
          wrote on last edited by
          #4

          Thanks! I think I got it: If calling GetWindow in a loop, there might be some problem. Especially when they might be some window-hierarchy change during the loop. But still confused why there might be run-into a endless loop?

          1 Reply Last reply
          0
          • T ThatsAlok

            xrg_soft@163.com wrote:

            Does anybody know in which case will the risks(caught in an infinite loop or referencing a handle to a window that has been destroyed) happen?

            Any specific reason to use GetWindow instead of EnumChildWindows?

            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
            Never mind - my own stupidity is the source of every "problem" - Mixture

            cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

            X Offline
            X Offline
            xrg_soft 163 com
            wrote on last edited by
            #5

            GetWindow still exists and not marked as obsoleted by MS.

            T 1 Reply Last reply
            0
            • X xrg_soft 163 com

              GetWindow still exists and not marked as obsoleted by MS.

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              xrg_soft@163.com wrote:

              GetWindow still exists and not marked as obsoleted by MS.

              try FindWindow then!

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
              Never mind - my own stupidity is the source of every "problem" - Mixture

              cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

              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