Jump to content
Sign in to follow this  
Guest XoroX

Ideas On How To Activate A Window Based On Hwnd?

Recommended Posts

Guest XoroX

Hey, used the search function on the forums and looked everywhere for some information pertaining to this and couldnt come up with anything.

Basically what I want to be able to do is use WinActivate to activate a window based on a handle(hwnd) that i have obtained using WinGetHandle. The reason I am doing this is that I have two instances of the same application running and want to be able to discriminate between the two so that I can be sure of which one I am dealing with. Thanks in advance and if this is in any way unclear please feel free to ask me any questions.

Here is a snippet of some general stuff I am trying just to get it to work.

AutoItSetOption("WinTitleMatchMode", 4)
$handle = WinGetHandle("classname=Notepad")
MsgBox(0, "AutoIt", $handle)
WinActivate("handle=$handle", "")
Edited by XoroX

Share this post

Link to post
Share on other sites

WinActivate("handle=" & $handle)

Or you ccould add the handle= when you get the handle:

$handle = "handle=" & WinGetHandle("classname=Notepad")

Share this post

Link to post
Share on other sites

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
Sign in to follow this