Ryan H. Posted January 12, 2006 Share Posted January 12, 2006 Using the c# code below, I am attempting to use a window handle to get the Windows title by using the WinGetTitle function. string handle = auto.WinGetHandle("Test Window Title", string.Empty); auto.AutoItSetOption("WinTitleMatchMode", 4); string text = auto.WinGetTitle(handle, string.Empty); When this code executes, the WinGetTitle method is consistently returning a value of 1. What am I doing wrong? Thanks for the help, Ryan Link to comment Share on other sites More sharing options...
Valik Posted January 13, 2006 Share Posted January 13, 2006 You don't have "handle=" in the handle string. Link to comment Share on other sites More sharing options...
Ryan H. Posted January 13, 2006 Author Share Posted January 13, 2006 You don't have "handle=" in the handle string.Thanks! That did it. Link to comment Share on other sites More sharing options...
Jamal Mazrui Posted January 24, 2006 Share Posted January 24, 2006 (edited) I thought a Window handle could be used instead of a Window title in any of the matching modes. The help topic entitled "Window Titles and Text (Advanced)" includes the following statement: "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." ---------- Edited January 24, 2006 by Jamal Mazrui Link to comment Share on other sites More sharing options...
PeterSwiss Posted January 25, 2006 Share Posted January 25, 2006 I thought a Window handle could be used instead of a Window title in any of the matching modes. The help topic entitled "Window Titles and Text (Advanced)" includes the following statement: "When you have a handle you may use it in place of the titleparameter in any of the function calls that use the title/text convention."---------- You can use a handle in every function that asks for a window title, however only if WinTitleMatchMode is set to 4. And the handle in the window title string has to be in the format "handle=" + WHND, where WHND is a hexadecimal string of no more than 8 hex digits. Examples: "handle=0d0d080", "handle=045e0" . You can obtain WHND from autoitx WinGetHandle as a hex string, or from Shell.Application or from WSHExtend and need to convert it to a hex string. Link to comment Share on other sites More sharing options...
Jamal Mazrui Posted January 25, 2006 Share Posted January 25, 2006 What you say may be the intent of the developers, but it is consistent with neither the documentation I referenced nor my testing of code. Specifically, I used the window handle returned from GuiCreate as a parameter to WinMove to resize a form before showing it. No error resulted and the window was resized, whether match mode was 1 or 4. Link to comment Share on other sites More sharing options...
PeterSwiss Posted January 25, 2006 Share Posted January 25, 2006 What you say may be the intent of the developers, but it is consistent with neither the documentation I referenced nor my testing of code. Specifically, I used the window handle returned from GuiCreate as a parameter to WinMove to resize a form before showing it. No error resulted and the window was resized, whether match mode was 1 or 4.You're right but in the wrong subforum. Here is AutoItX. Your quotes and test results are from Autoit resp. consistent with AutoIt. 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