application remote with user32.dll functions


Reinhard Vornholt


I am trying to write a small application to remote another application.
Nothing special just
some mouse movement and clicking. But somehow it is not working. I figured
already that I cant
use the encapsulated win32 methods of the framework. So I searched the net
for some code and came up with the code you see below, but its not working.
The application I am trying to remote is a actually a game and it is running
in fullscreen mode.

Thats what I have until now:

private const uint WM_MOUSEMOVE = 0x0200;
private const uint WM_LBUTTONDOWN = 0x0201;
private const uint WM_LBUTTONUP = 0x0202;

public static extern IntPtr FindWindow(
string lpClassName, // class name
string lpWindowName // window name

public static extern IntPtr SendMessage(
IntPtr hWnd, // handle to destination window
uint Msg, // message
int wParam, // first message parameter
int lParam // second message parameter

public static void LeftMouseClick(IntPtr handle)
SendMessage(handle, WM_LBUTTONDOWN, 0, 0);

SendMessage(handle, WM_LBUTTONUP, 0, 0);

public static IntPtr MoveMouse(IntPtr handle, int x, int y)
return SendMessage(handle, WM_MOUSEMOVE, (int)0, MakeLParam(x,y));

private static int MakeLParam(int LoWord, int HiWord)
return (int) ((HiWord << 16) | (LoWord & 0xffff));

And when I do this:

IntPtr aom = Win32.FindWindow(AOMCLASS, AOMWINDOW);

int i = (int) MoveMouse(aom, AOM_MULTIPLAYER_X, AOM_MULITPLAYER_Y);

nothing happens
What am I doing wrong? Can someone help?

And is the a list of all the WM_... values? I found these in the net but
couldn't find a list of all of them.



Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question