Prev: Centralised MsgBox
Next: Updating the VB EXE
From: Karl E. Peterson on 7 Oct 2009 15:27 mayayana wrote: > I don't know whether this is anything to worry about, > but it says this under EnumChildWindows: > > "This function is more reliable than calling the GetWindow function 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. " Haven't followed what the problem in this thread may be, but that sentence right there is why I switched "forever" to Enum* at VB5 when AddressOf was added! -- ..NET: It's About Trust! http://vfred.mvps.org
From: Eduardo on 7 Oct 2009 22:37 > I test for "begins with" and "ends with" which allows the same code to work in > either VB5 or VB6, compiled or not. Good idea.
From: Eduardo on 7 Oct 2009 22:50 mayayana escribi�: > I don't know whether this is anything to worry about, > but it says this under EnumChildWindows: > > "This function is more reliable than calling the GetWindow function 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. " What I would like to know is in what condition(s) those problems could happen. Because it doesn't help much just as the phrase is. In the past I used code with GetWindow to get the Zorder of the controls in a form, because the controls appear ordered by their Zorder. I don't know if with EnumChildWindows they also appear ordered this way. For this particular case, the OP could use EnumChildWindows.
From: Nobody on 7 Oct 2009 23:20 "Eduardo" <mm(a)mm.com> wrote in message news:hajk12$6d9$1(a)aioe.org... > I don't know if with EnumChildWindows they also appear ordered this way. Yes they are. Quote from the remarks section: "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."
From: Eduardo on 8 Oct 2009 03:21
Nobody escribi�: > "Eduardo" <mm(a)mm.com> wrote in message news:hajk12$6d9$1(a)aioe.org... >> I don't know if with EnumChildWindows they also appear ordered this way. > > Yes they are. Quote from the remarks section: "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." OK. I like the GetWindow method because it's easier. And about the problems... they don't specify how they could happen, but I suspect that for looking for form's controls handles in a fast loop when you are not removing or adding controls or changing the Zorder, it should be fine; and also for finding a textbox (it's a guess). |