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 


PostMessage with mouse click.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
LolSalad
Grandmaster Cheater
Reputation: 1

Joined: 26 Aug 2007
Posts: 988
Location: Australia

PostPosted: Mon Jul 07, 2008 7:38 pm    Post subject: PostMessage with mouse click. Reply with quote

What I want to do is simple; send a series of mouse clicks to a window using PostMessage. I've tried a heap of things, but nothing I can find seems to work.

The Delphi source code that I've used to test:
Code:
procedure TForm1.Timer1Timer(Sender: TObject);
var
  w:TPoint;
  fWnd:HWND;
  l:Longbool;
  l2:Longbool;
  r:TRect;
begin
  GetCursorPos(w);
  fWnd := FindWindow(nil, 'Calculator');
  GetWindowRect(fWnd, r);
  l := PostMessage(fWnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(w.X - r.Left, w.Y - r.Top));
  l2 := PostMessage(fWnd, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(w.X - r.Left, w.Y - r.Top));
  Label1.Caption := IntToStr(fWnd) + ', ' + IntToStr(r.Left) + ', ' + IntToStr(r.Top) + ', ' + BoolToStr(l) + ', ' + BoolToStr(l2);
end;


It should be sending a mouse click into the calculator window every second, but it's not. GetWindowRect is working, and it's getting the calculator window handle fine, but no mouse clicks are getting sent because the two PostMessages are returning -1, rather than 0.

Can someone point out where I am going wrong?

_________________
Back to top
View user's profile Send private message MSN Messenger
Drkgodz
Flash moderator
Reputation: 2

Joined: 17 Jul 2006
Posts: 2997
Location: Houston

PostPosted: Mon Jul 07, 2008 9:09 pm    Post subject: Reply with quote

You're finally trying postmessage?
_________________
Back to top
View user's profile Send private message
LolSalad
Grandmaster Cheater
Reputation: 1

Joined: 26 Aug 2007
Posts: 988
Location: Australia

PostPosted: Tue Jul 08, 2008 12:26 am    Post subject: Reply with quote

Dammit, I really need this help here D=
_________________
Back to top
View user's profile Send private message MSN Messenger
Drkgodz
Flash moderator
Reputation: 2

Joined: 17 Jul 2006
Posts: 2997
Location: Houston

PostPosted: Tue Jul 08, 2008 11:45 am    Post subject: Reply with quote

I need this too. Sad
_________________
Back to top
View user's profile Send private message
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