PostMessage mouse click to background window

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
mhcha
Junior Coder
Posts: 23
Joined: Sat Jan 01, 2022 11:10 am

PostMessage mouse click to background window

Post by mhcha » Sun Jun 11, 2023 1:39 pm

Code: Select all

LibFunc>User32,FindWindowA,res1,0,Messenger

LibFunc>User32,FindWindowExA,res2,res1,0,0,Chrome Legacy Window

Let>Xpos=570
Let>Ypos=579
Let>lparam={(%Ypos% * 65536) OR (%Xpos% AND 65535)}

LibFunc>User32,PostMessageA,res3,%res2%,200,0,%lparam%
LibFunc>User32,PostMessageA,res3,%res2%,201,1,%lparam%
LibFunc>User32,PostMessageA,res3,%res2%,202,0,%lparam%
hello,

This code snippet is an example of clicking after moving the mouse to the X, Y coordinates of a specific program.

I know the macro scheduler has great mouse move and click functionality, but the code snippet above has the advantage of being able to click to a specific location in an inactive program.
So, there is a greater advantage in automating tasks.

But that code doesn't work. Thanks for letting me know what's wrong with this code.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts