00 Win32 SDK程序创建一些控件

Post date: 2012/4/24 上午 06:48:55

在Win32 SDK中创建一些控件的时候需要注意一下(具体是哪些控件请参看MSDN文档中列出来的)

[cpp] view plaincopy

  1. /* MSDN:Carries information used to load common control classes from the
  2. * dynamic-link library (DLL).This structure is used with the InitCommonControlsEx function.
  3. * 需要使用的结构体和函数
  4. */
  5. typedef struct tagINITCOMMONCONTROLSEX {
  6. DWORD dwSize;
  7. DWORD dwICC;
  8. } INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX;
  9. /*
  10. The set of bit flags that indicate which common control classes will be loaded from
  11. the DLL.This can be a combination of the following values.
  12. ICC_ANIMATE_CLASS
  13. Load animate control class.
  14. ICC_BAR_CLASSES
  15. Load toolbar, status bar, trackbar, and ToolTip control classes.
  16. ICC_COOL_CLASSES
  17. Load rebar control class.
  18. ICC_DATE_CLASSES
  19. Load date and time picker control class.
  20. ICC_HOTKEY_CLASS
  21. Load hot key control class.
  22. ICC_INTERNET_CLASSES
  23. Load IP address class.
  24. ICC_LINK_CLASS
  25. Load a hyperlink control class.
  26. ICC_LISTVIEW_CLASSES
  27. Load list-view and header control classes.
  28. ICC_NATIVEFNTCTL_CLASS
  29. Load a native font control class.
  30. ICC_PAGESCROLLER_CLASS
  31. Load pager control class.
  32. ICC_PROGRESS_CLASS
  33. Load progress bar control class.
  34. ICC_STANDARD_CLASSES
  35. Load one of the intrinsic User32 control classes. The user controls include button,
  36. edit, static, listbox, combobox, and scrollbar.
  37. ICC_TAB_CLASSES
  38. Load tab and ToolTip control classes.
  39. ICC_TREEVIEW_CLASSES
  40. Load tree-view and ToolTip control classes.
  41. ICC_UPDOWN_CLASS
  42. Load up-down control class.
  43. ICC_USEREX_CLASSES
  44. Load ComboBoxEx class.
  45. ICC_WIN95_CLASSES
  46. Load animate control, header, hot key, list-view, progress bar, status bar, tab, ToolTip,
  47. toolbar, trackbar, tree-view, and up-down control classes.
  48. */
  49. BOOL InitCommonControlsEx(const LPINITCOMMONCONTROLSEX lpInitCtrls);
  50. // 例如创建ListView控件,需要先这样
  51. // 包含相关的头文件和加载对应的lib库文件
  52. #include <commctrl.h>
  53. #pragma comment(lib, "comctl32.lib")
  54. INITCOMMONCONTROLSEX icc = {sizeof(icc), ICC_LISTVIEW_CLASSES};
  55. InitCommonControlsEx(&icc);