是否可以将点击发送给所有 windows setup.exe 个安装程序(windows 个程序)

Is to possible to send clicks to all windows setup.exe installers (windows programs)

我试图在表面上实现的目标似乎相对简单:在没有任何用户输入的情况下将 windows 安装程序破解为 运行。

不幸的是,我没有 msi,运行使用静默安装标签安装安装程序没有结果。我也研究过将 .exe 包装到 .msi 中,但导致死胡同。

然后,我想既然安装程序毕竟是一个 windows 程序,也许我可以将鼠标点击和键盘敲击发送给它。

但是,我做不到。简短的测试程序 运行 没有错误,但复选框仍然没有被选中。

我用其他程序测试了这个方法,它有效。我的猜测是,要使 SendMessage() 正常工作,必须构建应用程序来侦听和响应消息?

接下来,我想我可以使用 SendInput() 函数强制发送鼠标点击

int _tmain(int argc, _TCHAR* argv[])
{
    HWND handle = (HWND)0x008105CC;

    GetWindowRect(handle, &rec);

    double x = rec.left;
    double y = (rec.top + rec.bottom) / 2;

    LPARAM lparam = MAKELPARAM(x, y);

    SetCursorPos(x, y);

    INPUT input;
    input.type = INPUT_MOUSE;
    input.mi.dx = 0;
    input.mi.dy = 0;
    input.mi.dwFlags = (MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP);
    input.mi.mouseData = 0;
    input.mi.dwExtraInfo = NULL;
    input.mi.time = 0;

    SendInput(1, &input, sizeof(INPUT));

    return 0;
}

然而,那也失败了!再一次,我测试了检查另一个应用程序中的另一个复选框,它起作用了。所以,我很困惑为什么发送点击,我希望它独立于特定的程序进程,但在所有程序中都不起作用???

我们使用 AutoIt 来处理这样的事情:

AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required! AutoIt was initially designed for PC “roll out” situations to reliably automate and configure thousands of PCs. Over time it has become a powerful language that supports complex expressions, user functions, loops and everything else that veteran scripters would expect.