In WPF, I can push a message loop using Dispatcher.PushFrame.
What is the equivalent in WinForms? I'm familiar with DoEvents but that must be called in a loop which can spin the CPU instead of the very efficient approach of just waiting for a message or for an event to signal to exit (like Dispatcher.PushFrame has).
This is the equivalent:
The 42 is a
stateparameter that gets past to the callback.You can also do this:
BTW, you should never ever ever use
DoEvents- it's a great way to introduce bugs in to your code and is really only there for VB6 compatibility.