Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

There are two types of DLLs which are using MFC:

- MFC regular DLL

- MFC extension DLL

The major difference is that you can use regular DLLs in non-MFC projects (C, C++, Pascal, Visual Basic, and so on) whereas extension DLLs can be used only in MFC executable or DLL projects. Here are some details about using Prof-UIS in DLL projects.

Regular DLL

This type of DLL can be used in any projects regardless of whether they are MFC or non-MFC DLL/EXE. Any MFC-based Active X project is an example of the most often used kind of MFC regular DLL project. For example, a Frame Features Active X control presented on our site is also a regular DLL.

Any regular DLL has its own global CWinApp-derived object usually named theApp. The regular DLL uses its own copy of the MFC host and for all the exported methods the current module state should be explicitly set with MFC's AFX_MANAGE_STATE macro at the beginning of each exported method.

To use Prof-UIS in your regular DLL project, include Prof-UIS.h in the StdAfx.h file, define the __PROF_UIS_FOR_REGULAR_DLLpreprocessor symbol in the project settings, and invoke the following code in the InitInstance()virtual method of the CWinApp-derived class:

CExt_ProfUIS_ModuleState::InitExtension(
    AfxGetStaticModuleState()
    );

If you use the ProfAuto library, additionally include the ../ProfAuto/Prof-UIS-AutomationPack.h file and invoke the code below:

CExt_ProfAuto_ModuleState::InitExtension(
    AfxGetStaticModuleState()
    );

If you use the ProfSkin library, additionally include the ./ProfSkin/ProfSkin.h file and invoke the code below:

CExt_ProfSkin_ModuleState::InitExtension(
    AfxGetStaticModuleState()
    );

If you have both a Prof-UIS based EXE and use a regular DLL, they have their own independent hosts of Prof-UIS and MFC. That means these two modules use independent copies of the Prof-UIS paint manager and you need to toggle between supported themes synchronously in both modules.

Extension DLL

This type of DLL can be used only in MFC-based EXE projects, in MFC extension projects, and in MFC regular DLL projects. Prof-UIS supports both a set of extension DLL configurations and a set if regular DLL extension configurations. The later is marked with the RDE label. Such a division cannot be avoided because a DLL is initialized differently in EXE projects and in regular DLL projects.

The extension DLL does not have its own global CWinApp-derived object and uses the same MFC and Prof-UIS hosts as in the module in which it is loaded. So, you do not need to care about Prof-UIS theme synchronization issues for this type of DLL at all.

To use Prof-UIS in your MFC/Prof-UIS-based EXE project or in your extension DLL project, it is enough just to include Prof-UIS.h in the StdAfx.h file. Do not forget to include ../ProfAuto/Prof-UIS-AutomationPack.h if you use the ProfAuto  library and ../ProfSkin/ProfSkin.h  for ProfSkin.