| View previous topic :: View next topic |
| Author |
Message |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Sun Dec 07, 2008 2:40 pm Post subject: [C#]PostMessage problems |
|
|
I can't seem to get PostMessage to work...
| Code: |
SetCursorPos(x, y);
PostMessage(hWnd, 0x201,0, 0);
Thread.Sleep(100);
PostMessage(hWnd, 0x202,0, 0);
|
SetCursorPos works, but not the PostMessages. Anyone know why?
And this also...
| Code: |
for (int i = 0; i >= 100; i++)
{
PostMessage(hWnd, WM_KEYDOWN, 0x44, (MapVirtualKey(0x44, 0) << 16) + 1);
Thread.Sleep(100);
PostMessage(hWnd, WM_KEYUP, 0x44, (MapVirtualKey(0x44, 0) << 16) + 1);
}
|
Can anyone tell me what's wrong with it?
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sun Dec 07, 2008 3:08 pm Post subject: |
|
|
| as far as i know if you want it to click where the cursor is, you need to set a value to the lParam/wParam. that means use GetCursorPos to fill in a POINT and then read off the values into lParam and wParam.
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Sun Dec 07, 2008 3:24 pm Post subject: |
|
|
| Code: | | for (int i = 0; i >= 100; i++) |
how is that supposed to work? >= 100 ?
you must specify the points to click in the lParam of the PostMessage.
Also note, that you need to hookhop if you are sending to maple and that maple uses direct input for directional keys. If not to maple, then nm.
_________________
|
|
| Back to top |
|
 |
FullyAwesome I post too much
Reputation: 0
Joined: 05 Apr 2007 Posts: 4438 Location: Land Down Under
|
Posted: Sun Dec 07, 2008 4:05 pm Post subject: |
|
|
this is what i used for a single click in MS. if you can set the cursor fine in MS then this is all that's needed
values of the variables:
WM_LBUTTONDOWN = 0x0201
MK_LBUTTON = 0x0001
this is what you call for making the LParam:
| Code: | private uint MakeLParam(int LoWord, int HiWord)
{
return (uint)((HiWord << 16) | (LoWord & 0xFFFF));
} |
| Code: |
hhPostMessageA(hWnd, WM_LBUTTONDOWN, MK_LBUTTON, MakeLParam(x, y))
|
the dll i used for the bypassed PostMessage (i was too lazy to work with C++) was from sloppy in this thread.
_________________
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Sun Dec 07, 2008 7:41 pm Post subject: |
|
|
| kitterz wrote: | | Code: | | for (int i = 0; i >= 100; i++) |
how is that supposed to work? >= 100 ?
you must specify the points to click in the lParam of the PostMessage.
Also note, that you need to hookhop if you are sending to maple and that maple uses direct input for directional keys. If not to maple, then nm. |
It loops 100 times? It's not MapleStory...
|
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Sun Dec 07, 2008 8:20 pm Post subject: |
|
|
um Yea should be <
Some one's sig saying you dont know much is right o.0?
_________________
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sun Dec 07, 2008 8:45 pm Post subject: |
|
|
lol.
| Code: |
for( int i = 0; i >= 100; i++ )
|
won't loop at all: since i is never greater than or equal to 100, it never performs the code in the loop.
| Code: |
for( int i = 0; i <= 100; i++ )
|
that loops 101 times: 1 - 100 = 100, plus when i = 0.
| Code: |
for( int i = 0; i < 100; i++ )
|
and
| Code: |
for( int i = 1; i <= 100; i++ )
|
both loop 100 times.
_________________
|
|
| Back to top |
|
 |
Hieroglyphics I post too much
Reputation: 0
Joined: 06 Dec 2007 Posts: 2007 Location: Your bedroom
|
Posted: Sun Dec 07, 2008 9:39 pm Post subject: |
|
|
I lold mike asking for help with POSTMESSAGE?
_________________
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Sun Dec 07, 2008 9:40 pm Post subject: |
|
|
| Hieroglyphics wrote: | | I lold mike asking for help with POSTMESSAGE? |
Wow, you're so ignorant loooool. I'm really offended by such a bias comment like that from a mediocre at coding and a pro at riding intermediate users dick. loooooooool.
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Sun Dec 07, 2008 10:02 pm Post subject: |
|
|
| _void_ wrote: | | kitterz wrote: | | Code: | | for (int i = 0; i >= 100; i++) |
how is that supposed to work? >= 100 ?
you must specify the points to click in the lParam of the PostMessage.
Also note, that you need to hookhop if you are sending to maple and that maple uses direct input for directional keys. If not to maple, then nm. |
It loops 100 times? It's not MapleStory... |
i meant as in how does it loop 100 times, wrong signs.
_________________
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Sun Dec 07, 2008 10:05 pm Post subject: |
|
|
| kitterz wrote: | | _void_ wrote: | | kitterz wrote: | | Code: | | for (int i = 0; i >= 100; i++) |
how is that supposed to work? >= 100 ?
you must specify the points to click in the lParam of the PostMessage.
Also note, that you need to hookhop if you are sending to maple and that maple uses direct input for directional keys. If not to maple, then nm. |
It loops 100 times? It's not MapleStory... |
Yeah my bad I totally forgot
i meant as in how does it loop 100 times, wrong signs. |
Yeah, I was coding it in 1 in the morning.
Last edited by &Vage on Mon Dec 08, 2008 12:18 pm; edited 1 time in total |
|
| Back to top |
|
 |
FullyAwesome I post too much
Reputation: 0
Joined: 05 Apr 2007 Posts: 4438 Location: Land Down Under
|
Posted: Sun Dec 07, 2008 11:32 pm Post subject: |
|
|
so have you fixed your problem yet...?
_________________
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Wed Dec 10, 2008 12:51 am Post subject: |
|
|
| Slugsnack wrote: | | as far as i know if you want it to click where the cursor is, you need to set a value to the lParam/wParam. that means use GetCursorPos to fill in a POINT and then read off the values into lParam and wParam. |
Before saying stuff like this, read about notifications/messages @ MSDN.
|
|
| Back to top |
|
 |
DaNemeziz Master Cheater
Reputation: 0
Joined: 29 Sep 2007 Posts: 430
|
Posted: Wed Dec 10, 2008 7:29 pm Post subject: |
|
|
It's already said but I will repeat it.
| Code: | | PostMessage(hWnd, 0x201,0, 0); |
It doesn't mather where you set your cursor before, with that you click at the point "0". You have to set the mouse position in the lParam. This is an example for Visual Basic (not C# but it maybe helps you to understand).
| Code: | PostMessage(hWnd, &H201, 0, MakelParam(Cursor.Position.X, Cursor.Position.Y)) 'button down
PostMessage(hWnd, &H202, 0, MakelParam(Cursor.Position.X, Cursor.Position.Y)) 'button up
PostMessage(hWnd, &H203, 0, MakelParam(Cursor.Position.X, Cursor.Position.Y)) 'double click, since its maplestory AC and you just need double clicks for somethings :P |
|
|
| Back to top |
|
 |
crayzbeef Expert Cheater
Reputation: 0
Joined: 21 Jan 2007 Posts: 101
|
Posted: Sun Dec 14, 2008 6:24 pm Post subject: |
|
|
| _void_ wrote: | | Hieroglyphics wrote: | | I lold mike asking for help with POSTMESSAGE? |
Wow, you're so ignorant loooool. I'm really offended by such a bias comment like that from a mediocre at coding and a pro at riding intermediate users dick. loooooooool. |
Judging by your response you were offended. Ha.
|
|
| Back to top |
|
 |
|