共用方式為


Windows 通用控制項的組建需求

Microsoft Foundation Class (MFC) 程式庫支援 Windows Common Controls 。 通用控制項包含在 Windows 中,且程式庫包含在 Visual Studio 中。 MFC 程式庫提供可增強現有類別的新方法,以及支援 Windows 通用控制項的其他類別和方法。 當您建置應用程式時,您應該遵循下列章節中描述的編譯和移轉需求。

編譯需求

支援的版本

MFC 支援所有通用控制項版本。 如需 Windows 通用控制項版本的相關資訊,請參閱 通用控制項版本

支援的字元集。

Windows Common Controls 僅支援 Unicode 字元集,而不是 ANSI 字元集。 如果您已在命令列建置應用程式,請使用下列二者定義 (/D) 編譯器選項,以指定 Unicode 做為基底字元集:

/D_UNICODE /DUNICODE

如果您在 Visual Studio 整合式開發環境 (IDE) 中建置應用程式,請在專案屬性的 [一般 ] 節點中 ,指定 [字元集] 屬性的 Unicode 字元集 選項

移轉需求

如果您使用 Visual Studio IDE 來建置使用 Windows 通用控制項的新 MFC 應用程式,IDE 會自動宣告適當的資訊清單。 不過,如果您從 Visual Studio 2005 或更早版本移轉現有的 MFC 應用程式,而且您想要使用通用控制項,IDE 不會自動提供資訊清單資訊來升級您的應用程式。 相反地,您必須在先行編譯標頭檔中手動插入下列原始程式碼:

#ifdef UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif

另請參閱

一般 MFC 主題
階層架構圖表
已被取代的 ANSI API