::PostMessage Win32 API equivalent?? 
Author Message
 ::PostMessage Win32 API equivalent??

Is there a way to push a user message to the message queue for serving a
form or windows like the PostMessage Win32 API in C#? I found the class
Windows.Forms.Message structure but don't know how to post it to the queue


Tue, 21 Jun 2005 02:20:09 GMT  
 ::PostMessage Win32 API equivalent??
Sai,

    You can use the PostMessage API in .NET.  Here is the declaration that
you need:

[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern bool PostMessage(
    IntPtr hWnd,
    [MarshalAs(UnmanagedType.U4)] int Msg,
    IntPtr wParam,
    IntPtr lParam);

    You MIGHT be able to get away with this (I am not sure, but worth a
try):

[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern bool PostMessage(System.Windows.Forms.Message Msg);

    The reason being that the Message structure might be marshaled in the
same manner and order on the stack that SendMessage/PostMessage would expect
them.

    Hope this helps.

--
          - Nicholas Paldino [.NET/C# MVP]



Quote:
> Is there a way to push a user message to the message queue for serving a
> form or windows like the PostMessage Win32 API in c#? I found the class
> Windows.Forms.Message structure but don't know how to post it to the queue



Tue, 21 Jun 2005 07:51:35 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. gettempfilename (win32 api) equivalent in c#

2. Using Win32 API's or equivalent function

3. win32 equivalent of getuid()

4. What is MFC TRACE equivalent in Win32 ?

5. std::cin equivalent in win32 app (newbie)

6. File Locking- fcntl equivalent in Win32

7. CE equivalent of Win32 SetThreadToken()

8. Functional equivalent to ODBC API call in ADO ??

9. Functional equivalent to ODBC API call in ADO ??

10. CFormView equivalent in API

11. is there an api equivalent for atoi?

12. CFormView equivalent in API

 

 
Powered by phpBB® Forum Software