Share via


Are there any MFC classes or functions that cannot be used in an MFC DLL?

OverviewHow Do IFAQDetailsSample

Extension DLLs use the CWinApp-derived class of the client application. They must not have their own CWinApp-derived class.

Regular DLLs must have a CWinApp-derived class and a single object of that application class, as does an MFC application. Unlike the CWinApp object of an application, the CWinApp object of the DLL does not have a main message pump.

The following MFC capabilities are not applicable in regular DLLs, either because of technical limitations or because those services are usually provided by the application.

  • CWinApp::Enable3dControls

  • CWinApp::SetDialogBkColor (color is ignored for message boxes)

Note that the CWinApp::Run mechanism does not apply to a DLL, since the application owns the main message pump. If the DLL opens modeless dialog boxes or has a main frame window of its own, the application's main message pump must call a routine exported by the DLL, which in turn calls the CWinApp::PreTranslateMessage member function of the DLL's application object.