简体   繁体   中英

Can not click on control

I'm using AutoItX.Dotnet 3.3.14.5 from here and this is my code:

var win = AutoIt.AutoItX.WinGetHandle(txtWindowTitle.Text);
if (win != (IntPtr) 0)
{
    var cont = AutoIt.AutoItX.ControlGetHandle(win, "&Next >");
    AutoIt.AutoItX.ControlClick(win, cont);
}

Everything works well and it will execute the control-click (it will return 1 as I know it clicked), but nothing will happen. I mean by Clicking on that button something should happen but no click will happen on it. Where Am I wrong?

Make sure you are running your application with admin rights.

ControlClick ( "title", "text", controlID [, button = "left" [, clicks = 1 [, x [, y]]]] )

Also, some windows app won't respond to ControlClick unless they are active/in focus. Try this:

var win = AutoIt.AutoItX.WinGetHandle(txtWindowTitle.Text);
if (win != (IntPtr) 0)
{
    AutoIt.AutoItX.WinActivate(win);
    var cont = AutoIt.AutoItX.ControlGetHandle(win, "&Next >");
    AutoIt.AutoItX.ControlClick(win, "", cont);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM