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#]PostMessage problems
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Sun Dec 07, 2008 2:40 pm    Post subject: [C#]PostMessage problems Reply with quote

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
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sun Dec 07, 2008 3:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Sun Dec 07, 2008 3:24 pm    Post subject: Reply with quote

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.

Code:
MAKELPARAM (x,y)


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
View user's profile Send private message Send e-mail
FullyAwesome
I post too much
Reputation: 0

Joined: 05 Apr 2007
Posts: 4438
Location: Land Down Under

PostPosted: Sun Dec 07, 2008 4:05 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Sun Dec 07, 2008 7:41 pm    Post subject: Reply with quote

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.

Code:
MAKELPARAM (x,y)


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
View user's profile Send private message
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Sun Dec 07, 2008 8:20 pm    Post subject: Reply with quote

um Yea should be <

Some one's sig saying you dont know much is right o.0?

_________________
Back to top
View user's profile Send private message Send e-mail
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sun Dec 07, 2008 8:45 pm    Post subject: Reply with quote

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.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Hieroglyphics
I post too much
Reputation: 0

Joined: 06 Dec 2007
Posts: 2007
Location: Your bedroom

PostPosted: Sun Dec 07, 2008 9:39 pm    Post subject: Reply with quote

I lold mike asking for help with POSTMESSAGE?
_________________

Back to top
View user's profile Send private message AIM Address MSN Messenger
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Sun Dec 07, 2008 9:40 pm    Post subject: Reply with quote

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
View user's profile Send private message
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Sun Dec 07, 2008 10:02 pm    Post subject: Reply with quote

_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.

Code:
MAKELPARAM (x,y)


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
View user's profile Send private message Send e-mail
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Sun Dec 07, 2008 10:05 pm    Post subject: Reply with quote

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.

Code:
MAKELPARAM (x,y)


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
View user's profile Send private message
FullyAwesome
I post too much
Reputation: 0

Joined: 05 Apr 2007
Posts: 4438
Location: Land Down Under

PostPosted: Sun Dec 07, 2008 11:32 pm    Post subject: Reply with quote

so have you fixed your problem yet...?
_________________
Back to top
View user's profile Send private message MSN Messenger
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Wed Dec 10, 2008 12:51 am    Post subject: Reply with quote

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
View user's profile Send private message
DaNemeziz
Master Cheater
Reputation: 0

Joined: 29 Sep 2007
Posts: 430

PostPosted: Wed Dec 10, 2008 7:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
crayzbeef
Expert Cheater
Reputation: 0

Joined: 21 Jan 2007
Posts: 101

PostPosted: Sun Dec 14, 2008 6:24 pm    Post subject: Reply with quote

_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
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
Goto page 1, 2  Next
Page 1 of 2

 
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