📄 commctrl.h
字号:
/*****************************************************************************\
* *
* commctrl.h - - Interface for the Windows Common Controls *
* *
* Version 1.2 *
* *
* Copyright (c) Microsoft Corporation. All rights reserved. *
* *
\*****************************************************************************/
#ifndef _INC_COMMCTRL
#define _INC_COMMCTRL
#ifndef _WINRESRC_
#ifndef _WIN32_IE
#define _WIN32_IE 0x0501
#else
#if (_WIN32_IE < 0x0400) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
#error _WIN32_IE setting conflicts with _WIN32_WINNT setting
#endif
#endif
#endif
#ifndef _HRESULT_DEFINED
#define _HRESULT_DEFINED
typedef LONG HRESULT;
#endif // _HRESULT_DEFINED
#ifndef NOUSER
//
// Define API decoration for direct importing of DLL references.
//
#ifndef WINCOMMCTRLAPI
#if !defined(_COMCTL32_) && defined(_WIN32)
#define WINCOMMCTRLAPI DECLSPEC_IMPORT
#else
#define WINCOMMCTRLAPI
#endif
#endif // WINCOMMCTRLAPI
//
// For compilers that don't support nameless unions
//
#ifndef DUMMYUNIONNAME
#ifdef NONAMELESSUNION
#define DUMMYUNIONNAME u
#define DUMMYUNIONNAME2 u2
#define DUMMYUNIONNAME3 u3
#define DUMMYUNIONNAME4 u4
#define DUMMYUNIONNAME5 u5
#else
#define DUMMYUNIONNAME
#define DUMMYUNIONNAME2
#define DUMMYUNIONNAME3
#define DUMMYUNIONNAME4
#define DUMMYUNIONNAME5
#endif
#endif // DUMMYUNIONNAME
#ifdef __cplusplus
extern "C" {
#endif
//
// Users of this header may define any number of these constants to avoid
// the definitions of each functional group.
//
// NOTOOLBAR Customizable bitmap-button toolbar control.
// NOUPDOWN Up and Down arrow increment/decrement control.
// NOSTATUSBAR Status bar control.
// NOMENUHELP APIs to help manage menus, especially with a status bar.
// NOTRACKBAR Customizable column-width tracking control.
// NODRAGLIST APIs to make a listbox source and sink drag&drop actions.
// NOPROGRESS Progress gas gauge.
// NOHOTKEY HotKey control
// NOHEADER Header bar control.
// NOIMAGEAPIS ImageList apis.
// NOLISTVIEW ListView control.
// NOTREEVIEW TreeView control.
// NOTABCONTROL Tab control.
// NOANIMATE Animate control.
// NOBUTTON Button control.
// NOSTATIC Static control.
// NOEDIT Edit control.
// NOLISTBOX Listbox control.
// NOCOMBOBOX Combobox control.
// NOSCROLLBAR Scrollbar control.
//
//=============================================================================
#include <prsht.h>
#ifndef SNDMSG
#ifdef __cplusplus
#ifndef _MAC
#define SNDMSG ::SendMessage
#else
#define SNDMSG ::AfxSendMessage
#endif
#else
#ifndef _MAC
#define SNDMSG SendMessage
#else
#define SNDMSG AfxSendMessage
#endif //_MAC
#endif
#endif // ifndef SNDMSG
#ifdef _MAC
#ifndef RC_INVOKED
#ifndef _WLM_NOFORCE_LIBS
#ifndef _WLMDLL
#ifdef _DEBUG
#pragma comment(lib, "comctld.lib")
#else
#pragma comment(lib, "comctl.lib")
#endif
#pragma comment(linker, "/macres:comctl.rsc")
#else
#ifdef _DEBUG
#pragma comment(lib, "msvcctld.lib")
#else
#pragma comment(lib, "msvcctl.lib")
#endif
#endif // _WLMDLL
#endif // _WLM_NOFORCE_LIBS
#endif // RC_INVOKED
#endif //_MAC
WINCOMMCTRLAPI void WINAPI InitCommonControls(void);
#if (_WIN32_IE >= 0x0300)
typedef struct tagINITCOMMONCONTROLSEX {
DWORD dwSize; // size of this structure
DWORD dwICC; // flags indicating which classes to be initialized
} INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX;
#define ICC_LISTVIEW_CLASSES 0x00000001 // listview, header
#define ICC_TREEVIEW_CLASSES 0x00000002 // treeview, tooltips
#define ICC_BAR_CLASSES 0x00000004 // toolbar, statusbar, trackbar, tooltips
#define ICC_TAB_CLASSES 0x00000008 // tab, tooltips
#define ICC_UPDOWN_CLASS 0x00000010 // updown
#define ICC_PROGRESS_CLASS 0x00000020 // progress
#define ICC_HOTKEY_CLASS 0x00000040 // hotkey
#define ICC_ANIMATE_CLASS 0x00000080 // animate
#define ICC_WIN95_CLASSES 0x000000FF
#define ICC_DATE_CLASSES 0x00000100 // month picker, date picker, time picker, updown
#define ICC_USEREX_CLASSES 0x00000200 // comboex
#define ICC_COOL_CLASSES 0x00000400 // rebar (coolbar) control
#if (_WIN32_IE >= 0x0400)
#define ICC_INTERNET_CLASSES 0x00000800
#define ICC_PAGESCROLLER_CLASS 0x00001000 // page scroller
#define ICC_NATIVEFNTCTL_CLASS 0x00002000 // native font control
#endif
#if (_WIN32_WINNT >= 0x501)
#define ICC_STANDARD_CLASSES 0x00004000
#define ICC_LINK_CLASS 0x00008000
#endif
WINCOMMCTRLAPI BOOL WINAPI InitCommonControlsEx(LPINITCOMMONCONTROLSEX);
#endif // _WIN32_IE >= 0x0300
#define ODT_HEADER 100
#define ODT_TAB 101
#define ODT_LISTVIEW 102
//====== Ranges for control message IDs =======================================
#define LVM_FIRST 0x1000 // ListView messages
#define TV_FIRST 0x1100 // TreeView messages
#define HDM_FIRST 0x1200 // Header messages
#define TCM_FIRST 0x1300 // Tab control messages
#if (_WIN32_IE >= 0x0400)
#define PGM_FIRST 0x1400 // Pager control messages
#if (_WIN32_WINNT >= 0x501)
#define ECM_FIRST 0x1500 // Edit control messages
#define BCM_FIRST 0x1600 // Button control messages
#define CBM_FIRST 0x1700 // Combobox control messages
#endif
#define CCM_FIRST 0x2000 // Common control shared messages
#define CCM_LAST (CCM_FIRST + 0x200)
#define CCM_SETBKCOLOR (CCM_FIRST + 1) // lParam is bkColor
typedef struct tagCOLORSCHEME {
DWORD dwSize;
COLORREF clrBtnHighlight; // highlight color
COLORREF clrBtnShadow; // shadow color
} COLORSCHEME, *LPCOLORSCHEME;
#define CCM_SETCOLORSCHEME (CCM_FIRST + 2) // lParam is color scheme
#define CCM_GETCOLORSCHEME (CCM_FIRST + 3) // fills in COLORSCHEME pointed to by lParam
#define CCM_GETDROPTARGET (CCM_FIRST + 4)
#define CCM_SETUNICODEFORMAT (CCM_FIRST + 5)
#define CCM_GETUNICODEFORMAT (CCM_FIRST + 6)
#if (_WIN32_IE >= 0x0500)
#if (_WIN32_WINNT >= 0x501)
#define COMCTL32_VERSION 6
#else
#define COMCTL32_VERSION 5
#endif
#define CCM_SETVERSION (CCM_FIRST + 0x7)
#define CCM_GETVERSION (CCM_FIRST + 0x8)
#define CCM_SETNOTIFYWINDOW (CCM_FIRST + 0x9) // wParam == hwndParent.
#if (_WIN32_WINNT >= 0x501)
#define CCM_SETWINDOWTHEME (CCM_FIRST + 0xb)
#define CCM_DPISCALE (CCM_FIRST + 0xc) // wParam == Awareness
#endif
#endif // (_WIN32_IE >= 0x0500)
#endif // (_WIN32_IE >= 0x0400)
#if (_WIN32_IE >= 0x0400)
// for tooltips
#define INFOTIPSIZE 1024
#endif
//====== WM_NOTIFY Macros =====================================================
#define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \
(fn)((hwnd), (int)(wParam), (NMHDR *)(lParam))
#define FORWARD_WM_NOTIFY(hwnd, idFrom, pnmhdr, fn) \
(LRESULT)(fn)((hwnd), WM_NOTIFY, (WPARAM)(int)(idFrom), (LPARAM)(NMHDR *)(pnmhdr))
//====== Generic WM_NOTIFY notification codes =================================
#define NM_OUTOFMEMORY (NM_FIRST-1)
#define NM_CLICK (NM_FIRST-2) // uses NMCLICK struct
#define NM_DBLCLK (NM_FIRST-3)
#define NM_RETURN (NM_FIRST-4)
#define NM_RCLICK (NM_FIRST-5) // uses NMCLICK struct
#define NM_RDBLCLK (NM_FIRST-6)
#define NM_SETFOCUS (NM_FIRST-7)
#define NM_KILLFOCUS (NM_FIRST-8)
#if (_WIN32_IE >= 0x0300)
#define NM_CUSTOMDRAW (NM_FIRST-12)
#define NM_HOVER (NM_FIRST-13)
#endif
#if (_WIN32_IE >= 0x0400)
#define NM_NCHITTEST (NM_FIRST-14) // uses NMMOUSE struct
#define NM_KEYDOWN (NM_FIRST-15) // uses NMKEY struct
#define NM_RELEASEDCAPTURE (NM_FIRST-16)
#define NM_SETCURSOR (NM_FIRST-17) // uses NMMOUSE struct
#define NM_CHAR (NM_FIRST-18) // uses NMCHAR struct
#endif
#if (_WIN32_IE >= 0x0401)
#define NM_TOOLTIPSCREATED (NM_FIRST-19) // notify of when the tooltips window is create
#endif
#if (_WIN32_IE >= 0x0500)
#define NM_LDOWN (NM_FIRST-20)
#define NM_RDOWN (NM_FIRST-21)
#define NM_THEMECHANGED (NM_FIRST-22)
#endif
#ifndef CCSIZEOF_STRUCT
#define CCSIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member))
#endif
//====== Generic WM_NOTIFY notification structures ============================
#if (_WIN32_IE >= 0x0401)
typedef struct tagNMTOOLTIPSCREATED
{
NMHDR hdr;
HWND hwndToolTips;
} NMTOOLTIPSCREATED, * LPNMTOOLTIPSCREATED;
#endif
#if (_WIN32_IE >= 0x0400)
typedef struct tagNMMOUSE {
NMHDR hdr;
DWORD_PTR dwItemSpec;
DWORD_PTR dwItemData;
POINT pt;
LPARAM dwHitInfo; // any specifics about where on the item or control the mouse is
} NMMOUSE, *LPNMMOUSE;
typedef NMMOUSE NMCLICK;
typedef LPNMMOUSE LPNMCLICK;
// Generic structure to request an object of a specific type.
typedef struct tagNMOBJECTNOTIFY {
NMHDR hdr;
int iItem;
#ifdef __IID_DEFINED__
const IID *piid;
#else
const void *piid;
#endif
void *pObject;
HRESULT hResult;
DWORD dwFlags; // control specific flags (hints as to where in iItem it hit)
} NMOBJECTNOTIFY, *LPNMOBJECTNOTIFY;
// Generic structure for a key
typedef struct tagNMKEY
{
NMHDR hdr;
UINT nVKey;
UINT uFlags;
} NMKEY, *LPNMKEY;
// Generic structure for a character
typedef struct tagNMCHAR {
NMHDR hdr;
UINT ch;
DWORD dwItemPrev; // Item previously selected
DWORD dwItemNext; // Item to be selected
} NMCHAR, *LPNMCHAR;
#endif // _WIN32_IE >= 0x0400
//====== WM_NOTIFY codes (NMHDR.code values) ==================================
#define NM_FIRST (0U- 0U) // generic to all controls
#define NM_LAST (0U- 99U)
#define LVN_FIRST (0U-100U) // listview
#define LVN_LAST (0U-199U)
// Property sheet reserved (0U-200U) - (0U-299U) - see prsht.h
#define HDN_FIRST (0U-300U) // header
#define HDN_LAST (0U-399U)
#define TVN_FIRST (0U-400U) // treeview
#define TVN_LAST (0U-499U)
#define TTN_FIRST (0U-520U) // tooltips
#define TTN_LAST (0U-549U)
#define TCN_FIRST (0U-550U) // tab control
#define TCN_LAST (0U-580U)
// Shell reserved (0U-580U) - (0U-589U)
#define CDN_FIRST (0U-601U) // common dialog (new)
#define CDN_LAST (0U-699U)
#define TBN_FIRST (0U-700U) // toolbar
#define TBN_LAST (0U-720U)
#define UDN_FIRST (0U-721) // updown
#define UDN_LAST (0U-740)
#if (_WIN32_IE >= 0x0300)
#define MCN_FIRST (0U-750U) // monthcal
#define MCN_LAST (0U-759U)
#define DTN_FIRST (0U-760U) // datetimepick
#define DTN_LAST (0U-799U)
#define CBEN_FIRST (0U-800U) // combo box ex
#define CBEN_LAST (0U-830U)
#define RBN_FIRST (0U-831U) // rebar
#define RBN_LAST (0U-859U)
#endif
#if (_WIN32_IE >= 0x0400)
#define IPN_FIRST (0U-860U) // internet address
#define IPN_LAST (0U-879U) // internet address
#define SBN_FIRST (0U-880U) // status bar
#define SBN_LAST (0U-899U)
#define PGN_FIRST (0U-900U) // Pager Control
#define PGN_LAST (0U-950U)
#endif
#if (_WIN32_IE >= 0x0500)
#ifndef WMN_FIRST
#define WMN_FIRST (0U-1000U)
#define WMN_LAST (0U-1200U)
#endif
#endif
#if (_WIN32_WINNT >= 0x0501)
#define BCN_FIRST (0U-1250U)
#define BCN_LAST (0U-1350U)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -