Valhalla Legends Archive

Programming => General Programming => .NET Platform => Topic started by: Insolence on August 14, 2005, 03:37 AM

Title: [C#] Moving the mouse?
Post by: Insolence on August 14, 2005, 03:37 AM
Having a hell of a time simply moving the mouse, here's what I got so far:
    [DllImport("user32.dll")]
    public extern static int SendMessage( IntPtr hwnd, uint msg, uint wParam, long lParam);

User32.SendMessage(this.Handle, (int)WM.MOUSEMOVE, 0, MakeLong ( PixelRect[i,0], PixelRect[i,1] ) );

WM.MOUSEDOWN = 0x0200 like it should, I can't think of any other things to check.  I've changed the import castings (is that what you'd call it?) many times... not sure what else I can do =\
Title: Re: [C#] Moving the mouse?
Post by: TehUser on August 14, 2005, 09:14 AM
WM_MOUSEMOVE is the notification windows get when the mouse has moved.  As far as I know, it doesn't actually move the cursor.  What you want is SetCursorPos (http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/resources/cursors/cursorreference/cursorfunctions/setcursorpos.asp).
Title: Re: [C#] Moving the mouse?
Post by: Insolence on August 14, 2005, 01:57 PM
That seems to be working, thanks a ton :)