GoForIt has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I'm using Win32::GuiTest module to open XVI32 hex editor. This module and its methods suits my automation project but somehow FindWindowLike() method returns two window handles. But for other applications like notepad, calculator, it returns one window handle as expected. There are no other XVI32 window that's open when I run my script. So, I'm clueless as to why this happens for this particular app.

use strict; use warnings; use Win32::GuiTest qw(:ALL); my $exe = "C:\\XVI32.exe"; system "start $exe"; sleep(1); my @windows = (); @windows = FindWindowLike(undef, "XVI32", "", undef, 0);

The size of this array is two by default and if there's another XVI32 window is open, then the size becomes 4. It increments in multiples of 2.

Has this something to do with the system command?

Thanks,

Replies are listed 'Best First'.
Re: Win32::GuiTest and XVI32 Editor
by BrowserUk (Patriarch) on Apr 09, 2010 at 12:03 UTC

    Use:

    @windows = FindWindowLike(undef, "XVI32", "TFormMain");

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Win32::GuiTest and XVI32 Editor
by Anonymous Monk on Apr 09, 2010 at 10:46 UTC
      Hi,

      I just figured this is not an error. I get two window handles because the first one is for the window itself and the second one for the opened file. Like how it works in Microsoft Visual C++ editor. After closing the file, the editor is still open. And that's precisely happening in my case too. I do a ALT F4 and the file gets closed and the XVI32 editor remains open which I need to close explicitly again

      I hope my understanding is correct

      Thanks,