If I remember correctly in addition to embedding the manifest in the DLL with resource ID 2 you also need to build the DLL and #define ISOLATION_AWARE_ENABLED 1. But I don't know if this works with VC++ 6.
Use Common Controls V6 in a .dll compiled using VC6
Hello,
I have a .dll compiled using VC6 (yes, I know it is a very old compiler but migrating is not a choice at this time).
I need to use the common dialogs 6, but it still loads the common dialogs 5.
I embedded a manifest using "2" as the ID but it still fails...
I coded (for testing) a very small VC6 Project and I used this code:
include <windows.h>
include <commctrl.h>
include <stdio.h>
include <stdlib.h>
include "resource.h"
HINSTANCE g_hInstance = NULL;
LONG PASCAL DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /lpReserved/) {
if (dwReason == DLL_PROCESS_ATTACH) {
g_hInstance = hInstance;
InitCommonControls();
}
return TRUE;
}
extern "C" __declspec(dllexport) void ShowDialog()
{
DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DlgProc);
}
/*****************************************************************************/
LONG PASCAL DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_COMMAND && (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)) {
EndDialog(hWnd, 1);
}
return FALSE;
}
Then I coded a little .exe that just calls ShowDialog...
If I use a .exe instead of a .dll it works fine (after embedding the manifest with ID 1).
this is the manifest:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity name="Test.Test.Test" processorArchitecture="x86" version="1.0.0.0" type="win32"></assemblyIdentity>
<description>Windows Shell</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
I embedded it using:
"C:......\Microsoft SDKs\Windows\v6.0\Bin\mt.exe" -manifest "zoptie.dll.Manifest.xml" -outputresource:"E:\temp\TestDll\Release\TestDll.dll";2
I can well see it is well embedded using PE Explorer:
But when I launch it, the look&feel is still the old one (the edit control should be flat):
What am I doing wrong?
Thanks
2 answers
Sort by: Most helpful
-
-
RLWA32 47,221 Reputation points
2020-12-17T22:19:25.67+00:00 In order to accomplish what you want to do with ISOLATION_AWARE_ENABLED you need to install and build with a different Windows SDK than the one you are using.
In a test, I installed the Microsoft Platform SDK February 2003 into VM containing VC++ 6 and used it to build a DLL that contained a dialog and was manifested to use the V6 Common Controls dll.
When I copied that DLL to a Windows 8.1 system and used it to display the dialog it worked as anticipated as seen below (note main application has "old style" controls but the test dialog uses visual styles.