一、在程序中包含commctrl.h頭文件,鏈接到ComCtl32.lib,并調(diào)用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
二、向項(xiàng)目中添加一個(gè)名為YourApp.exe.manifest的文件,其中的YourApp就寫你的可執(zhí)行文件的名稱,這個(gè)文件具有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
>
三、在應(yīng)用程序的資源文件(YourApp.rc)的頂部中添加這樣的一行語(yǔ)句:
CREATEPROCESS_MANIFEST_RESOURCE_ID?RT_MANIFEST?
"YourApp
.exe.manifest
"
我在程序中沒(méi)有做第一步也能成功,可能是因?yàn)闆](méi)有用API創(chuàng)建的窗口或動(dòng)態(tài)窗口,在程序中如果調(diào)用了CreateWindow函數(shù)去創(chuàng)建窗口,則需要執(zhí)行第一步。

