winapi - How to handle double click exactly? -


I want to execute a double click by clicking on the left mouse button twice. Between 2 click-time, I sleep 100m

SendInput (LEFT_CLICK ...);
Sleep (100);
SendInput (LEFT_CLICK ...);

It works fine in my PC, but may not work correctly in the virtual machine, there is a delay time when the machine does the "SendInput" function

I delete "sleep (100)", it only clicks 2 times

how to fix double click in this case

Please do me this

Thank you,

BTW You must specify that you In the atmosphere Working and expanding your code a little bit Using SendInput is an option, I do not know what you are actually trying to do, but I'll give you two more options to try to emulate clicks Something like this (I code in Python, but this should be the same idea):

  def leftClick (x = 0, y = 0): win32api.SetCursorPos ((x, y )) # Where you click on win32api.mouse_event (win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0) # to move the cursor Get Mouse Event Win32api.mouse_event (win32con.MOUSEEVENTF_LEFTUP, X, Y, 0, 0) Generate Deaf DoubleClick (X = 0, Y = 0): leftClick (x, y) leftClick (x, y)  

You can sleep for 50ms in between time sleep.leep (0.05) but it works for me without it and I have tested it in an vm.

Another option if you want to silently click without moving the cursor, then you can send a message to the window where you want to know the window handle (HWND), I agree That you pass the handle as a parameter. Def leftClick (x = 0, y = 0, hwnd): lParam = win32api.MAKELONG (X, y) # Capture your click coordinates Win32gui.SendMessage (hwnd, win32con.WM_LBUTTONDOWN Create AC long type, Win32con.MK_LBUTTON, Liparum) # send a message to the window which is below the left mouse button. Win32gui.SendMessage (hwnd, win32con.WM_LBUTTONUP, 0, Liparam) # Send a message to the window that the mouse left button is upwards True Return doubleClick (x = 0, y = 0, hwnd): leftClick (x, y, hwnd) LeftClick (x, y, hwnd)

or you can send messages to you.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -