Jump to content

Ideas On How To Activate A Window Based On Hwnd?


Recommended Posts

Guest XoroX
Posted (edited)

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
Posted

WinActivate("handle=" & $handle)

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

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

Guest XoroX
Posted
:whistle: Thank you ever so much, worked like a charm. B)

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...