What is strange, is that the launching program isn't able to find the
correct windows inside the launched program. Spy++ correctly sees
that the main window of the launched program has 7 child windows,
while both GetWindow(GW_HWNDNEXT) and EnumWindows() report only 4
child windows.
Does anyone know what method Spy++ uses to find its windows?
How quickly after launching the program do you look for them? I
wonder whether the problem isn't that the child windows cannot be
seen, but simply that they don't yet exist. I know I've had to use
Sleep, or WaitForInputIdle, or SendMessage(WM_NULL...) to ensure the
launched application has completed its initialisation before trying to
find its child windows.
Richard.
http://www.rtrussell.co.uk/
Bingo!
Yes, I was already calling WaitForInputIdle(), and even after that I
was waiting for the main window to appear in EnumWindows(); but I
added some code to check for the number of children, and if they
aren't all there, to wait some more ... and that was it!
I was looking for something difficult, like maybe EnumWindows() didn't
find Unicode windows or something (not that I know the launched
program has Unicode windows), it didn't occur to me that the reason I
wasn't seeing the windows is that they weren't there yet ...
Thanks!
Chris
>On Nov 8, 3:44�pm, Richard Russell <n...@rtrussell.co.uk> wrote:
>> On Nov 8, 6:47�pm, Chris Shearer Cooper
>>
>> <chris.shearer.coo...@gmail.com> wrote:
>> > What is strange, is that the launching program isn't able to find the
>> > correct windows inside the launched program.
>>
>> How quickly after launching the program do you look for them? �I
>> wonder whether the problem isn't that the child windows cannot be
>> seen, but simply that they don't yet exist. �I know I've had to use
>> Sleep, or WaitForInputIdle, or SendMessage(WM_NULL...) to ensure the
>> launched application has completed its initialisation before trying to
>> find its child windows.
>>
>> Richard.http://www.rtrussell.co.uk/
>
>Bingo!
>
>Yes, I was already calling WaitForInputIdle(), and even after that I
>was waiting for the main window to appear in EnumWindows(); but I
>added some code to check for the number of children, and if they
>aren't all there, to wait some more ... and that was it!
***
WaitForInputIdle indicates the message pump has blocked. So without knowing how the child
process manages its windows, there is no way to guess.
joe
****
>
>I was looking for something difficult, like maybe EnumWindows() didn't
>find Unicode windows or something (not that I know the launched
>program has Unicode windows), it didn't occur to me that the reason I
>wasn't seeing the windows is that they weren't there yet ...
>
>Thanks!
>Chris
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm