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.
- What exactly does "Application" refer to in this scenario? Is it the whole MFC application, or the .net form?
- Why doesn't Application.Idle fire?
UPDATE
I managed to get it work, here are the two possible solutions:
- show the form using Form.ShowDialog() (thus the form runs its own .net message pump)
- create a STA thread, create the form on the STA thread and call Application.Run(). Then you can use Form.Show() (the form uses the .net message pump in the thread it was created, in this case: .net STA thread)