How to control the mouse!

zhaozj2021-02-11  227

Control mouse

It is mainly to be judged by two aspects: (1) judging the position of the mouse, that is, get the position of the mouse stays on the screen. (2) Moving the mouse to the determined position. To implement this feature, use the setCursorpos function, which function is to set the mouse position. The declaration of this function is as follows: Public Declare Function SetCursorpos lib "user32" (Byval x as long, byval y is not enough, it is not enough, but also defines a custom variable in a Type format. Defined as: public Type Pointapix As longy as longend type it is used to store the mouse position (position on the screen). But a new problem appears: Where is the mouse? That is, how to get the position on the screen. This question is to use another function: getCursorpos, its function is to get the coordinates of the mouse on the screen. Its statement is as follows: Public Declare Function getCursorpos lib "user32" (LPPOINT AS POINTAPI) AS Long This allows the mouse to get the location of the mouse through the getCursorpos function, stored in a POINTAPI variable, and then set the position of the mouse by the SetCursorpos function. This will be very smooth to control the mouse!

转载请注明原文地址:https://www.9cbs.com/read-4894.html

New Post(0)