What is the PostMessage(to self) equivilent in .NET?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi;

In the windows API you could call PostMessage() to yourself (the window you
are in). Is there an equivilent in .NET so I can cause an event in my form to
trigger after all events presently in the queue complete?
 
Hi,

If you are referring specifically to the message queue, you have two
options.
1) Use PInvoke and call PostMessage
2) For current implementations of Windows Forms, the Control.BeginInvoke
results in a PostMessage. Therefore, if you call BeginInvoke from the
primary thread the current messages will be processed prior to the delegate
passed to BeginInvoke being completed. Of course BeginInvoke returns
immediately.

Hope this helps
 
Back
Top