about GetWindow function
-
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
-
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
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.
-
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
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" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
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.
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?
-
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" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
GetWindow still exists and not marked as obsoleted by MS.
-
GetWindow still exists and not marked as obsoleted by MS.
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" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You