This is closely related to an earlier question.
In the managed world:
- How do I check if the current thread has messages in its message queue?
- How do I yield to the OS and wait for a message in the current thread (like GetMessage or WaitMessage)?
I am looking for the managed equivalents without PInvoke.
You can use the AddMessageFilter function.
I don’t think there’s a blocking way how to do that without P/Invoke, since it’s beyond intentions of .NET.