Thursday, March 31, 2011

Can I get the functionality of MsgWaitForMultipleObjects in .Net CF?

We're migrating a C++ application to .Net CF. We need to monitor both the UI and several external events. I therefore wonder if we can get the same functionality of MsgWaitForMultipleObjects in the unmanaged world also in the managed world?

Edit: P/Invoke is not the complete answer I'm seeking, since what I meant was that we want the full functionality of what we have in the unmanaged world, meaning that when input messages are pumped, events and other sync objects are also monitored. We don't have access to the message pump in .Net, for obvious reasons. So where do we hook ourselves in for P/Invoking MsgWaitForMultipleObjects?

From stackoverflow
  • Use pinvoke.

  • What we'll need to do is actually to skip Application.Run(Form) and roll our own message loop as in the unmanaged world. Then we can use MsgWaitForMultipleObjects as described in the original question. This has been done also in SDF.

0 comments:

Post a Comment