| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		Symbol I'm a spammer
  Reputation: 0
  Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
  | 
		
			
				 Posted: Wed Nov 28, 2007 7:29 am    Post subject: PostMessageA In C#? :( | 
				       | 
			 
			
				
  | 
			 
			
				I know how to do it in delphi (with the first 5 bytes bypass but that doesn't count its not my method...   ) and I tried to do in in C#: (I don't need the bypass... its not for maple. yet.   )
 
 	  | 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 | 
		 | 
	
	
		  | 
	
	
		appalsap Moderator
  Reputation: 0
  Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
  | 
		
			
				 Posted: Wed Nov 28, 2007 7:31 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				you have to define the WM_* messages yourself, convert them from C to C# from winuser.h
 _________________
  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Symbol I'm a spammer
  Reputation: 0
  Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
  | 
		
			
				 Posted: Wed Nov 28, 2007 7:45 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Alright, how would I do that? How can I see whats in winuser.h?  
 
 
Edit: 
 
 	  | Code: | 	 		  #define WM_Close            105
 
#endif | 	        
  Last edited by Symbol on Wed Nov 28, 2007 7:49 am; edited 1 time in total | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		appalsap Moderator
  Reputation: 0
  Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
  | 
		
			
				 Posted: Wed Nov 28, 2007 7:46 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				by opening it in notepad
 _________________
  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Symbol I'm a spammer
  Reputation: 0
  Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
  | 
		
			
				 Posted: Wed Nov 28, 2007 7:56 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | Code: | 	 		  | #define WM_CLOSE                        0x0010 | 	  
 
Hehe, thanks appalsap, helping again! now converting.  
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		samuri25404 Grandmaster Cheater
  Reputation: 7
  Joined: 04 May 2007 Posts: 955 Location: Why do you care?
  | 
		
			
				 Posted: Wed Nov 28, 2007 1:29 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Actually, you'll probably want to do it in an enum:
 
 
 	  | Code: | 	 		  
 
enum Messages
 
{
 
VM_Close = 107,
 
Whatever,
 
Whatevr,
 
Whatver
 
}
 
 | 	  
 _________________
  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		atom0s Moderator
  Reputation: 205
  Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
  | 
		 | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		 |