Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Invisible Mouse Clicks .Net

Name: Anonymous 2010-01-19 18:30

So I already know how to simulate mouse clicks, but I was wondering if there was a way to simulate a click without the actual cursor. The user can keep moving their mouse while the program simulated mouse clicks somewhere else.
Code in vb.net or C#.net appreciated.

Name: Anonymous 2010-01-19 18:37

>>1
You have to understand the underlying OS to do that.
On Win32, a mouse click is the same as a message sent to a window, which means you can fake it (it would be the same as a real one) by doing a SendMessage call with the parameters set properly (hWnd to the target window, Msg = WM_LBUTTONDOWN (or appropriate, look them up in MSDN):

WM_LBUTTONDOWN
fwKeys = wParam;        // key flags
xPos = LOWORD(lParam);  // horizontal position of cursor
yPos = HIWORD(lParam);  // vertical position of cursor


Doing it in C# or any other language would mean using the FFI or calling it directly. For C#, you need to write a p/invoke import for SendMessage.

btw, /prog/ isn't a place for asking questions that can be easily googlable.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List