Alain Posted December 29, 2023 Share Posted December 29, 2023 Hi team I am new using AutoIT, basically I am doing a C# test using your libs. But no luck with my code, ControlGetHandle is not working for me. Some idea?, I am missing something?, How I can "debug" ControlGetHandle?? AutoItX.Init(); AutoItX.AutoItSetOption("WinTitleMatchMode", 2); AutoItX.AutoItSetOption("WinSearchChildren", 1); AutoItX.AutoItSetOption("WinDetectHiddenText", 1); //Return a valid handle var winHandle = AutoItX.WinGetHandle("SIESAPOS"); //Return 000000 var controlHandle1= AutoItX.ControlGetHandle(winHandle, "[CLASS:WindowsForms10.EDIT.app.0.329445b_r7_ad1; INSTANCE:1]"); Link to comment Share on other sites More sharing options...
Andreik Posted December 29, 2023 Share Posted December 29, 2023 This question has been asked multiple times with different variations. Use regex to match the control class. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
ioa747 Posted December 29, 2023 Share Posted December 29, 2023 6 hours ago, Alain said: var controlHandle1= AutoItX.ControlGetHandle(winHandle, "[CLASS:WindowsForms10.EDIT.app.0.329445b_r7_ad1; INSTANCE:1]"); ControlGetHandle ( "title", "text", controlID ) => var controlHandle1= AutoItX.ControlGetHandle(winHandle, "", "[CLASS:WindowsForms10.EDIT.app.0.329445b_r7_ad1; INSTANCE:1]"); Danp2 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Alain Posted December 29, 2023 Author Share Posted December 29, 2023 Hi This syntax, wtih 3 params, not exists (from C# library) var controlHandle1= AutoItX.ControlGetHandle(winHandle, "", "[CLASS:WindowsForms10.EDIT.app.0.329445b_r7_ad1; INSTANCE:1]"); Thanks, Link to comment Share on other sites More sharing options...
Alain Posted December 29, 2023 Author Share Posted December 29, 2023 6 hours ago, Andreik said: This question has been asked multiple times with different variations. Use regex to match the control class. Hi Andreik, thanks But this "locator" - "[CLASS:WindowsForms10.EDIT.app.0.329445b_r7_ad1; INSTANCE:1]" is not changing from execution to execution, always is the same, but AutoIT not find the control. Some other idea about how I can "debug" this? Thanks in advance. Link to comment Share on other sites More sharing options...
Danp2 Posted December 29, 2023 Share Posted December 29, 2023 1 hour ago, Alain said: This syntax, wtih 3 params, not exists (from C# library) Not sure what C# library you are using (please share the details so that we can investigate), but AutoItX definitely supports / requires all three parameters for ControlGetHandle to properly function. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Alain Posted December 29, 2023 Author Share Posted December 29, 2023 1 hour ago, Danp2 said: Not sure what C# library you are using (please share the details so that we can investigate), but AutoItX definitely supports / requires all three parameters for ControlGetHandle to properly function. thanks by your support I am using And this one is used by this Wrapper DLL And if you check the header file, just have 2 params By the way ControlGetHandleAsText, not work either. Best regards Link to comment Share on other sites More sharing options...
Danp2 Posted December 29, 2023 Share Posted December 29, 2023 OIC... I guess the function parameters are different for the DLL & .NET interfaces. I was going to recommend that you try ControlGetHandleAsText, but you've mentioned that it isn't working for you. I suggest that you post your code showing what you tried with ControlGetHandleAsText. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Alain Posted December 29, 2023 Author Share Posted December 29, 2023 1 hour ago, Danp2 said: OIC... I guess the function parameters are different for the DLL & .NET interfaces. I was going to recommend that you try ControlGetHandleAsText, but you've mentioned that it isn't working for you. I suggest that you post your code showing what you tried with ControlGetHandleAsText. Thank you for your time. This is my code (ControlHandleXX always is 00000), but MainHandle return a valid Handle string windowTitle = "SIESAPOS"; IntPtr MainHandle = AutoItX.WinGetHandle(windowTitle); string Selector = "[CLASS:WindowsForms10.EDIT.app.0.329445b_r7_ad1; INSTANCE:1]"; IntPtr ControlHandle01 = AutoItX.ControlGetHandle(MainHandle, Selector); string ControlHandle02 = AutoItX.ControlGetHandleAsText(windowTitle, string.Empty, Selector); Link to comment Share on other sites More sharing options...
Danp2 Posted December 29, 2023 Share Posted December 29, 2023 IDK. Maybe someone else will respond with some ideas to assist you. Latest Webdriver UDF Release Webdriver Wiki FAQs 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