一、在程序中包含commctrl.h頭文件,鏈接到ComCtl32.lib,并調用InitCommon Controls.

#if ?(_WIN32_IE?>=?0x0300)
????INITCOMMONCONTROLSEX?iccx;
????iccx.dwSize?
= ? sizeof (iccx);
????iccx.dwICC?
= ?ICC_COOL_CLASSES? | ?ICC_BAR_CLASSES;
????BOOL?bRet?
= ?::InitCommonControlsEx( & iccx);
????bRet;
????ATLASSERT(bRet);
#else
????::InitCommonControls();
#endif


二、向項目中添加一個名為YourApp.exe.manifest的文件,其中的YourApp就寫你的可執行文件的名稱,這個文件具有XML格式:

?? <? xml?version="1.0"?encoding="UTF-8"?standalone="yes"? ?> ?
-?
< assembly? xmlns ="urn:schemas-microsoft-com:asm.v1" ?manifestVersion ="1.0" >
??
< assemblyIdentity? version ="1.0.0.0" ?processorArchitecture ="X86" ?name ="CompanyName.ProductName.YourApp" ?type ="win32" ? /> ?
??
< description > Your?application?description?here. </ description > ?
-?
< dependency >
-?
< dependentAssembly >
??
< assemblyIdentity? type ="win32" ?name ="Microsoft.Windows.Common-Controls" ?version ="6.0.0.0" ?processorArchitecture ="X86" ?publicKeyToken ="6595b64144ccf1df" ?language ="*" ? /> ?
??
</ dependentAssembly >
??
</ dependency >
??
</ assembly >

三、在應用程序的資源文件(YourApp.rc)的頂部中添加這樣的一行語句:

CREATEPROCESS_MANIFEST_RESOURCE_ID?RT_MANIFEST? "YourApp .exe.manifest "

我在程序中沒有做第一步也能成功,可能是因為沒有用API創建的窗口或動態窗口,在程序中如果調用了CreateWindow函數去創建窗口,則需要執行第一步。