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 


[C++] Can't get postmessage stuff working

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Fri Mar 06, 2009 6:32 pm    Post subject: [C++] Can't get postmessage stuff working Reply with quote

I can't get PostMessageA to left click properly
i've checked a bunch of tuts, and nothing is working.

current:

PostMessageA(GetForegroundWindow(), WM_LBUTTONDOWN, 1, (LPARAM)&pos);
PostMessageA(GetForegroundWindow(), WM_LBUTTONUP, 1, (LPARAM)&pos);

pos is defined as a POINT

anyone have any idea how to get it to click?

_________________
Back to top
View user's profile Send private message
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Fri Mar 06, 2009 6:44 pm    Post subject: Reply with quote

i had it changed to

Code:

PostMessageA(GetForegroundWindow(), WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(pos.x, pos.y));
PostMessageA(GetForegroundWindow(), WM_LBUTTONUP, 0, MAKELPARAM(pos.x, pos.y));


not working btw

_________________
Back to top
View user's profile Send private message
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Fri Mar 06, 2009 6:55 pm    Post subject: Reply with quote

Did you use GetCursorPos(&pos); ?
Back to top
View user's profile Send private message Visit poster's website
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Fri Mar 06, 2009 7:10 pm    Post subject: Reply with quote

talker0 wrote:
Did you use GetCursorPos(&pos); ?


yea

_________________
Back to top
View user's profile Send private message
slippppppppp
Grandmaster Cheater
Reputation: 0

Joined: 08 Aug 2006
Posts: 929

PostPosted: Fri Mar 06, 2009 9:52 pm    Post subject: Reply with quote

void LeftClick( HWND Wnd, int X, int Y ) {
SetCursorPos( X, Y );
PostMessage( Wnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM( X, Y-22 ) ); //i minus 22 because y changes
return;
}
Back to top
View user's profile Send private message AIM Address MSN Messenger
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Sat Mar 07, 2009 7:29 am    Post subject: Reply with quote

slippppppppp wrote:
void LeftClick( HWND Wnd, int X, int Y ) {
SetCursorPos( X, Y );
PostMessage( Wnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM( X, Y-22 ) ); //i minus 22 because y changes
return;
}


this is really weird but nothing is working T_T

_________________
Back to top
View user's profile Send private message
manc
Grandmaster Cheater
Reputation: 1

Joined: 16 Jun 2006
Posts: 551

PostPosted: Sat Mar 07, 2009 11:36 am    Post subject: Reply with quote

AwayTheWInd wrote:
slippppppppp wrote:
void LeftClick( HWND Wnd, int X, int Y ) {
SetCursorPos( X, Y );
PostMessage( Wnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM( X, Y-22 ) ); //i minus 22 because y changes
return;
}


this is really weird but nothing is working T_T


Then the problem probably has to do with something else
Maybe you have the wrong hWnd?

You could always just do
Code:
SetCursorPos( x, y )
PostMessage( hWnd, WM_LBUTTONDOWN, 0, 0 );
PostMessage( hWnd, WM_LBUTTONUP, 0, 0 );


rather than setting it and clicking in the same function.

Also, what are you trying to send it to?
Hooked functions maybe?

_________________
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sat Mar 07, 2009 12:54 pm    Post subject: Reply with quote

Y Changes because of the title bar.

Use ScreenToClient/ClientToScreen to fix the coordinates.

_________________
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