Jump to content

Using Handles in ControlSend


Jon310
 Share

Recommended Posts

I was reading this in the helpfile and was wondering how the handle could be used in the application described.

Window Handles / HWNDs

The variant datatype in AutoIt natively supports window handles (HWNDs). A window handle is a special value that windows assigns to a window each time it is created. When you have a handle you may use it in place of the title parameter in any of the function calls that use the title/text convention. The advantage of using window handles is that if you have multiple copies of an application open - which have the same title/text - you can uniquely identify them when using handles. When you use a window handle for the title parameter then the text parameter is completely ignored.

Various functions such as WinGetHandle, WinList and GUICreate return these handles. It is important to note that a window handle is not classed as a number or string - it is it's own special type.

Would it be used like:

ControlSend(0x000B0750, "", "", "Test")oÝ÷ ØêÚºÚ"µÍÛÛÛÙ[
    ][ÝÌ
ÍL ][ÝË  ][ÝÉ][ÝË    ][ÝÉ][ÝË    ][ÝÕÝ    ][ÝÊ

Or am I looking at it all wrong. Im trying to get it to send to a particular window when many windows of that same name are open.

Link to comment
Share on other sites

Also look up WinGetHandle()

you will also want to put this command towards the beginning of your script:

AutoItSetOption("WinTitleMatchMode", 4)

In answer to your second question, each window has a separate and unique handle. If you get the handle of the "Active" notepad, then this handle will always refer to that window, even when it is no longer active (until the window ceases to exits)

Edited by improbability_paradox
Link to comment
Share on other sites

Also look up WinGetHandle()

you will also want to put this command towards the beginning of your script:

AutoItSetOption("WinTitleMatchMode", 4)

In answer to your second question, each window has a separate and unique handle. If you get the handle of the "Active" notepad, then this handle will always refer to that window, even when it is no longer active (until the window ceases to exits)

Perfect, works like a charm, thanks for all the help.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...