View previous topic :: View next topic |
Author |
Message |
AwayTheWInd Master Cheater
Reputation: 0
Joined: 11 Sep 2007 Posts: 450
|
Posted: Fri Mar 06, 2009 6:32 pm Post subject: [C++] Can't get postmessage stuff working |
|
|
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 |
|
 |
AwayTheWInd Master Cheater
Reputation: 0
Joined: 11 Sep 2007 Posts: 450
|
Posted: Fri Mar 06, 2009 6:44 pm Post subject: |
|
|
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 |
|
 |
talkerzero Grandmaster Cheater
Reputation: 1
Joined: 24 Jul 2008 Posts: 560 Location: California
|
Posted: Fri Mar 06, 2009 6:55 pm Post subject: |
|
|
Did you use GetCursorPos(&pos); ?
|
|
Back to top |
|
 |
AwayTheWInd Master Cheater
Reputation: 0
Joined: 11 Sep 2007 Posts: 450
|
Posted: Fri Mar 06, 2009 7:10 pm Post subject: |
|
|
talker0 wrote: | Did you use GetCursorPos(&pos); ? |
yea
_________________
|
|
Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Fri Mar 06, 2009 9:52 pm Post subject: |
|
|
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 |
|
 |
AwayTheWInd Master Cheater
Reputation: 0
Joined: 11 Sep 2007 Posts: 450
|
Posted: Sat Mar 07, 2009 7:29 am Post subject: |
|
|
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 |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Sat Mar 07, 2009 11:36 am Post subject: |
|
|
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 |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sat Mar 07, 2009 12:54 pm Post subject: |
|
|
Y Changes because of the title bar.
Use ScreenToClient/ClientToScreen to fix the coordinates.
_________________
|
|
Back to top |
|
 |
|