在Win32 SDK中创建一些控件的时候需要注意一下(具体是哪些控件请参看MSDN文档中列出来的)
[cpp]
/* MSDN:Carries information used to load common control classes from the
* dynamic-link library (DLL).This structure is used with the InitCommonControlsEx function.
* 需要使用的结构体和函数
*/
typedef struct tagINITCOMMONCONTROLSEX {
DWORD dwSize;
DWORD dwICC;
} INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX;
/*
The set of bit flags that indicate which common control classes will be loaded from
the DLL.This can be a combination of the following values.
ICC_ANIMATE_CLASS
Load animate control class.
ICC_BAR_CLASSES
Load toolbar, status bar, trackbar, and ToolTip control classes.
ICC_COOL_CLASSES
Load rebar control class.
ICC_DATE_CLASSES
Load date and time picker control class.
ICC_HOTKEY_CLASS
Load hot key control class.
ICC_INTERNET_CLASSES
Load IP address class.
ICC_LINK_CLASS
Load a hyperlink control class.
ICC_LISTVIEW_CLASSES
Load list-view and header control classes.
ICC_NATIVEFNTCTL_CLASS
Load a native font control class.
ICC_PAGESCROLLER_CLASS
Load pager control class.
ICC_PROGRESS_CLASS
Load progress bar control class.
ICC_STANDARD_CLASSES
Load one of the intrinsic User32 control classes. The user controls include button,
edit, static, listbox, combobox, and scrollbar.
ICC_TAB_CLASSES
Load tab and ToolTip control classes.
ICC_TREEVIEW_CLASSES
Load tree-view and ToolTip control classes.
ICC_UPDOWN_CLASS
Load up-down control class.
ICC_USEREX_CLASSES
Load ComboBoxEx class.
ICC_WIN95_CLASSES
Load animate control, header, hot key, list-view, progress bar, status bar, tab, ToolTip,
toolbar, trackbar, tree-view, and up-down control classes.
*/
BOOL InitCommonControlsEx(const LPINITCOMMONCONTROLSEX lpInitCtrls);
// 例如创建ListView控件,,需要先这样
// 包含相关的头文件和加载对应的lib库文件
#include <commctrl.h>
#pragma comment(lib, "comctl32.lib")
INITCOMMONCONTROLSEX icc = {sizeof(icc), ICC_LISTVIEW_CLASSES};
InitCommonControlsEx(&icc);
Win32 SDK程序创建一些控件(简单调用InitCommonControlsEx,并指定ICC_LISTVIEW_CLASSES控件就可以了)