D 1.0 (Tango) 移动鼠标;模拟键盘按下等

发布于 2024-08-07 07:53:21 字数 949 浏览 2 评论 0原文

嘿,我正在使用 D 1.041 和 Tango 0.99.8,我想知道我将如何移动鼠标并模拟键盘按下并从屏幕获取信息,例如特定坐标上特定像素的颜色。我正在使用 Windows。

任何帮助将不胜感激。我想编写一个基于类的库,其功能类似于 AutoIt。例如:

mouse.move(100, 200);
mouse.click(2); // 2 = Middle Mouse Click
keyboard.type('abc');

import tango.sys.win32.UserGdi;

class Mouse{
    alias SetCursorPos set_pos;
    alias GetCursorPos get_pos;
    void left_click(){
        mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0);
        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0);
    }
    void right_click(){
        mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0);
        mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0);
    }
}

这段代码给我以下错误:

错误 42:符号未定义 _mouse_event@16 --- 错误级别 1

有什么帮助吗?我仍在使用版本

Hey, I'm using D 1.041 with Tango 0.99.8 and was wondering how I would go about moving the mouse and simulating keyboard presses and getting infos from the screen, for example the color of a specific pixel on a specific coordinate. I'm using Windows.

Any help would be greatly appreciated. I want to program a class-based library with functionality that resembles AutoIt's. For example:

mouse.move(100, 200);
mouse.click(2); // 2 = Middle Mouse Click
keyboard.type('abc');

import tango.sys.win32.UserGdi;

class Mouse{
    alias SetCursorPos set_pos;
    alias GetCursorPos get_pos;
    void left_click(){
        mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0);
        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0);
    }
    void right_click(){
        mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0);
        mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0);
    }
}

This code gives me the following error:

Error 42: Symbol Undefined
_mouse_event@16
--- errorlevel 1

Any help on that? I'm still using version.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水染的天色ゝ 2024-08-14 07:53:21

这是 Tango 中的一个错误。

Tango 将 mouse_event 声明为:

void mouse_event(DWORD, DWORD, DWORD, DWORD);

MSDN 显示它需要 5 个参数,而不是 4 个。

对于严肃的 Win32 开发,您应该查看 Windows API 绑定 项目。

This is a bug in Tango.

Tango declares mouse_event as:

void mouse_event(DWORD, DWORD, DWORD, DWORD);

while MSDN shows that it takes 5 parameters, not 4.

For serious Win32 development you should take a look at the Windows API bindings project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文