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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top