Jon310 Posted February 12, 2007 Share Posted February 12, 2007 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 More sharing options...
Zedna Posted February 12, 2007 Share Posted February 12, 2007 Look at ControlGetHandle ( "title", "text", controlID ) in AutoIt HelpFile Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Jon310 Posted February 12, 2007 Author Share Posted February 12, 2007 Look at ControlGetHandle ( "title", "text", controlID ) in AutoIt HelpFileThanks for the help.One question. How would it distinguish one instance of say, notepad, versus the other 4 I have running? Link to comment Share on other sites More sharing options...
_Kurt Posted February 12, 2007 Share Posted February 12, 2007 If WinActive("whatever") Then ;do whatever EndIf and always use AU3 Info (located in your autoit directory) to see the handle's names. Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
improbability_paradox Posted February 12, 2007 Share Posted February 12, 2007 (edited) 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 February 12, 2007 by improbability_paradox Link to comment Share on other sites More sharing options...
Jon310 Posted February 12, 2007 Author Share Posted February 12, 2007 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now