D 1.0 (Tango) Move the mouse; simulate keystrokes, etc.

Hey, I use D 1.041 with Tango 0.99.8 and wondered how I would move by moving the mouse and simulating the keyboard, press and receive information from the screen, for example, the color of a specific pixel at a specific coordinate. I am using windows.

Any help would be greatly appreciated. I want to program a class-based library with functionality similar to AutoIt. 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 this? I am still using the version .

+3
source share
1

Tango.

Tango mouse_event :

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

while MSDN , 5 , 4.

Win32 API- Windows.

+2

Source: https://habr.com/ru/post/1719300/


All Articles