Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


move mouse in game X,Y

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
x_maddog_x
How do I cheat?
Reputation: 0

Joined: 14 Feb 2017
Posts: 2

PostPosted: Tue Feb 28, 2017 11:47 pm    Post subject: move mouse in game X,Y Reply with quote

i need help in my code, dont working!

internal const int WM_MOUSEMOVE = 0x200;

[DllImport("User32.dll")]
public static extern Int32 FindWindow(String lpClassName, String lpWindowName);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SendMessage(int hWnd, int msg, int wParam, IntPtr lParam);
private void button1_Click(object sender, EventArgs e)
{
int hwnd = FindWindow(null, "game");

int PosX = 300;
int PosY = 300;

SendMessage((int)hwnd, WM_MOUSEMOVE, PosX, IntPtr.Zero);
SendMessage((int)hwnd, WM_MOUSEMOVE, PosY, IntPtr.Zero);
}

NOT WORKING... this code put my mouse in top!
i need put real X , Y direction
Back to top
View user's profile Send private message
Viloresi
Expert Cheater
Reputation: 0

Joined: 02 Feb 2017
Posts: 149

PostPosted: Wed Mar 01, 2017 3:06 am    Post subject: Reply with quote

ChangeWM_MOUSEMOVE = 0x200;
To WM_MOUSEMOVE = 0x01;

The problem is that you are trying to move the mouse inside a game that maybe is an fps or a game where the view of the player is stick with the mouse cursor, so you can't move the mouse cursor since it will be blocked in the middle of the screen with the eventual weapon crosshair,
If you try to move it to a coordinate of the screen, if you use that function windows tries to move the mouse to these coordinates but ot never reaches them.

I've told you to use 0x01, after looking inside msdn I've seen maybe that's the parameter you should use. Aniway I hope you get the idea since I'm tyling from my phone I can't help you much:S
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Thu Mar 02, 2017 3:31 am    Post subject: Reply with quote

Not every game reacts to input the same. You may need to use something else such as SendInput, or if the game uses DirectInput, you may have to actually hook the input handling and manipulate it entirely yourself.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites