We have an application built against MFC9 (VC2008). The application is an SDI application, and shows a file open dialog during InitInstance(). Showing that dialog causes comdlg32.dll to be loaded. Some minutes later, the comdlg32.dll is unloaded automatically. After this, the next function depending on the DLL will crash.
How can this be avoided? What governs the automatic unloading/loading of the DLL?
Further info:
- We don't see this problem on WinXP with the same application.
- On Win7, this behavior only occurred since the beginning of this year - maybe some MFC update is related to this?
- A small test application does not exhibit the problematic behavior - the comdlg32.dll is re-loaded when needed.
- We’ve found a statement by Microsoft that it isn’t recommended to use modal dialogs in InitInstance() of MDI applications (http://support.microsoft.com/kb/173261) - we have an SDI application, though.
- We don't directly use comdlg32.dll in any way, only indirectly through the MFC.