Jump to content

Using window handles and looking for child windows


Recommended Posts

Greetings. I'm trying to use AutoItX from Perl, but I've run in some problems. First, for some reason I can't figure how to use handles. I think I'm doing everything according to manual, but yet this piece of code doesn't work:

use Win32::OLE;

unless($autoit=Win32::OLE->new("AutoItX3.Control")){
 die "Could not start AutoItX3 Control through OLE.\n";
}

unless($whandle=$autoit->WinGetHandle('something')) { die "Couldn't find window"; }
print "WHANDLE: $whandle\n";
$autoit->WinTitleMatchMode(4);
print "EXISTS: ", $autoit->WinExists("handle=$whandle"), "\n";

Line with print WHANDLE correctly prints found handle for window, but line with print EXISTS prints 0 as result of WinExists, for same handle. Do I miss something there? Actually OLE returns me error 0x80020003: "Member not found" every time I try to use WinTitleMatchMode, so I understand I simply can't get into mode 4 and that why handle= construction doesn't work, but I don't understand why I get this error.

Also is there a way to limit window search routines to childs of some previously found window? I couldn't find anything like this in documentation.

Edited by rowaasr13
Link to post
Share on other sites
  • 2 months later...

There does not seem to be much help on this topic. I have the same topic and definitely need to use window handles. I believe the help file tells the proble. It says the windos handle is its' own datatype that is not a string. The problem I see is that the activex interface inputs and outputs a string. I think we need to know how to type cast the string to a hwnd type. I am not sure if the interface is also polymorphic. If not I do not see how it can be done.

Link to post
Share on other sites
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...