0

Please tell me how to solve my little problem.

I am writing automation for the android emulator, where I use the win32api libraries to emulate actions in an inactive program window.

And at some point I need to send the mouse scroll to the emulator. For this I use:

lParam = win32api.MAKELONG (500, 500)

win32api.PostMessage (hwnd, win32con.WM_MOUSEWHEEL, win32con.MK_LBUTTON, lParam)

Thus, I scroll down. But, no matter how long I googling and looking for information, I cannot figure out how I can scroll up in the same way.

Hmm, for thoughts to click I use:

def Click (x, y):

lParam = win32api.MAKELONG (x, y)
win32api.PostMessage (hwnd, win32con.WM_MOUSEMOVE, lParam)
win32api.PostMessage (hwnd, win32con.WM_LBUTTONDOWN, win32con.MK_LBUTTON, lParam)
win32api.PostMessage (hwnd, win32con.WM_LBUTTONUP, win32con.MKF_LEFTBUTTONSEL, lParam)

Otherwise, I could not make a click.

1 Answers1

0

I solved this problem this way:

win32api.PostMessage(hwnd, win32con.WM_MOUSEWHEEL, win32con.WHEEL_DELTA * 5, lParam)
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
  • Welcome to Stack Overflow, and thank you for contributing an answer. Would you kindly edit your answer to to include an explanation of your code? That will help future readers better understand what is going on, and especially those members of the community who are new to the language and struggling to understand the concepts. – Jeremy Caney Nov 07 '21 at 00:20