본문 바로가기

Delphi/간단하게

간단하게 마우스 제어하기

윈도우API를 이용하여 마우스를 간단하게 제어해 보겠습니다.

mouse_event(MOUSEEVENTF_MOVE, X, Y, 0, 0);

//첫번째 파라미터 : 원하는 마우스의 상태를 결정합니다.

//두번째 파라미터 : 마우스의 X축 이동을 결정합니다.

//세번째 파라미터 : 마우스의 Y축 이동을 결정합니다.

//참조 -> https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-mouse_event

Event Flags

ValueMeaning
MOUSEEVENTF_ABSOLUTE
0x8000
The dx and dy parameters contain normalized absolute coordinates. If not set, those parameters contain relative data: the change in position since the last reported position. This flag can be set, or not set, regardless of what kind of mouse or mouse-like device, if any, is connected to the system. For further information about relative mouse motion, see the following Remarks section.
MOUSEEVENTF_LEFTDOWN
0x0002
The left button is down.
MOUSEEVENTF_LEFTUP
0x0004
The left button is up.
MOUSEEVENTF_MIDDLEDOWN
0x0020
The middle button is down.
MOUSEEVENTF_MIDDLEUP
0x0040
The middle button is up.
MOUSEEVENTF_MOVE
0x0001
Movement occurred.
MOUSEEVENTF_RIGHTDOWN
0x0008
The right button is down.
MOUSEEVENTF_RIGHTUP
0x0010
The right button is up.
MOUSEEVENTF_WHEEL
0x0800
The wheel has been moved, if the mouse has a wheel. The amount of movement is specified in dwData
MOUSEEVENTF_XDOWN
0x0080
An X button was pressed.
MOUSEEVENTF_XUP
0x0100
An X button was released.
MOUSEEVENTF_WHEEL
0x0800
The wheel button is rotated.
MOUSEEVENTF_HWHEEL
0x01000
The wheel button is tilted.



2019/07/09 - [ - Delphi] - 간단하게 키보드 제어하기


반응형