I'm building a .net plugin for a MFC application. I created a form using WinForms and .net4. The form is shown after user clicks a button in the MFC application. One of my controls uses Application.Idle to do some task.
The problem is, it seems Application.Idle is never fired.
UPDATE
I managed to get it work, here are the two possible solutions:
The only way that Winforms can figure out that the application is idle is when it doesn't find any other messages on the message queue. Your problem is that it is not Winforms that pumps the message loop, it is MFC. Which doesn't know anything about the Winforms bells and whistles. Other things go wrong, note that tabbing and short-cut keystrokes no longer work, also handled by the Winforms message loop.
There is no clean solution for this, there can be only one master. Very imperfect fixes are using Form.ShowDialog() and starting a new STA thread so that you can call Application.Run().