Jump to content

ControlGetHandle not working


Alain
 Share

Recommended Posts

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]"); 
   

 

image.png.526e836148af1c1ae5bbc9ba1f5b60d9.png

Link to comment
Share on other sites

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]");

I know that I know nothing

Link to comment
Share on other sites

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

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 

image.png.2487980ced806cb7965e2dd14dbdbe50.png

And this one is used by this Wrapper DLL

image.png.69fd04d7e6fc622da1f88b38be5ae0f7.png

And if you check the header file, just have 2 params

image.thumb.png.28e62fe8c22a44b268e8b48992571112.png

 

By the way ControlGetHandleAsText, not work either.

Best regards 

 

 

image.png

image.png

image.png

Link to comment
Share on other sites

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

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