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 


PostMessageA In C#? :(

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Wed Nov 28, 2007 7:29 am    Post subject: PostMessageA In C#? :( Reply with quote

I know how to do it in delphi (with the first 5 bytes bypass but that doesn't count its not my method... Laughing ) and I tried to do in in C#: (I don't need the bypass... its not for maple. yet. Rolling Eyes )
Code:
            [DllImport("User32.dll")]
            public static extern bool PostMessageA(??? hWnd,uint Msg,uint wParam,uint lParam);

There's no hWnd paramater, and when I use IntPtr then it says:
Code:
The name 'WM_Close' does not exist in the current context


So the message isn't a uint, and the hWnd is?
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Wed Nov 28, 2007 7:31 am    Post subject: Reply with quote

you have to define the WM_* messages yourself, convert them from C to C# from winuser.h
_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Wed Nov 28, 2007 7:45 am    Post subject: Reply with quote

Alright, how would I do that? How can I see whats in winuser.h? Shocked

Edit:
Code:
#define WM_Close            105
#endif
Neutral Neutral Neutral

Last edited by Symbol on Wed Nov 28, 2007 7:49 am; edited 1 time in total
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Wed Nov 28, 2007 7:46 am    Post subject: Reply with quote

by opening it in notepad
_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Wed Nov 28, 2007 7:56 am    Post subject: Reply with quote

Code:
#define WM_CLOSE                        0x0010

Hehe, thanks appalsap, helping again! now converting. Smile
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

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

PostPosted: Wed Nov 28, 2007 1:29 pm    Post subject: Reply with quote

Actually, you'll probably want to do it in an enum:

Code:

enum Messages
{
VM_Close = 107,
Whatever,
Whatevr,
Whatver
}

_________________
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
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed Nov 28, 2007 6:14 pm    Post subject: Reply with quote

Symbol wrote:
Code:
#define WM_CLOSE                        0x0010

Hehe, thanks appalsap, helping again! now converting. Smile


Incase you don't know, '0x' means hex.

So 0x0010 = 16 in decimal.

#define is basically making a constant. You are saying WM_CLOSE will always equal 0x0010 unless redefined elsewhere.

So you could do:

Code:
private const int WM_CLOSE = 16;


According to other sites for PostMessage:

Code:
   private static extern int PostMessage( IntPtr hWnd,
      int wMsg, int wParam, int lParam );

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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