Win10 cut with mouse_event function, move the mouse operation, find command, unable to realize mobile,
The code is as follows:
Private Declare Sub mouse Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics (ByVal nIndex As Long) As Long 'to get resolution
Private Const MOUSEEVENTF_ABSOLUTE=& amp; H8000 'specified mouse use absolute coordinate system, at this point, the screen in the horizontal and vertical directions evenly divided into 65535 x 65535 units
Private Const MOUSEEVENTF_MOVE=& amp; Move the mouse H1 '
Private Const MOUSEEVENTF_LEFTDOWN=& amp; The H2 'simulated mouse the left key press
Private Const MOUSEEVENTF_LEFTUP=& amp; H4 'simulation of mouse lift
Private Sub shubiaoyidong (ByVal x As Long, ByVal y As Long)
Mw=x * 65535/GetSystemMetrics32 (0)
Mh=y * 65535/GetSystemMetrics32 (1)
Mobile
'The mouse MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_MOVE, mw, mh, 0, 0
End Sub
Sub test ()
Shubiaoyidong 998, 745
End Sub
Click on the macro after the operation, find the mouse under the win10 unable to move, can't execute commands, felt here don't know what is the problem?
How to change Or to sign & amp; , although these commands, but in the process of executing commands will realize the function of the right mouse button click, perform chaotic situation, can't normal execution code, where is the great god can find out the problem? I asked the experience of the relevant personnel cannot give reasonable answer, a great god teacher please help to give directions!
CodePudding user response:
Why is invalid under Win10 unclear, you can try it temporarily toCall the Mouse (& amp; H8001, mw, mh, 0, 0)
Theory Or not may not be able to identify (& amp; H8001=& amp; H8000 Or & amp; H1)
Or try to change the parameters to try
The
Or is a operation, & amp; Is characters connection, the meaning is not the same as
Correspond to the Or And Xor Not this three
Here said the Or take absolute coordinates to simulate mouse
Don't understand why do you want to amend the Or as & amp;
Specific, you can try to write a program output Or connection, & amp; Connection, connect with And as a result, have a look at the difference