📄 commctrl.h
字号:
// 3) put a resource id number in lpszText
// and point hinst to the hinstance to load from
typedef struct {
NMHDR hdr;
LPSTR lpszText;
char szText[80];
HINSTANCE hinst;
UINT uFlags;
LPARAM lParam;
} TOOLTIPTEXT, FAR *LPTOOLTIPTEXT;
#endif //NOTOOLTIPS
/*/////////////////////////////////////////////////////////////////////////*/
#ifndef NOSTATUSBAR
/*REVIEW: Here exists the only known documentation for status bars. */
// SBS_* styles need to not overlap with CCS_* values
// want a size gripper on a status bar. this only applies if the
// DrawFrameControl function is available.
#define SBARS_SIZEGRIP 0x0100
/* DrawStatusText:
* This is used if the app wants to draw status in its client rect,
* instead of just creating a window. Note that this same function is
* used internally in the status bar window's WM_PAINT message.
* hDC is the DC to draw to. The font that is selected into hDC will
* be used. The RECT lprc is the only portion of hDC that will be drawn
* to: the outer edge of lprc will have the highlights (the area outside
* of the highlights will not be drawn in the BUTTONFACE color: the app
* must handle that). The area inside the highlights will be erased
* properly when drawing the text.
*/
WINCOMMCTRLAPI void WINAPI DrawStatusText(HDC hDC, LPRECT lprc, LPCSTR szText, UINT uFlags);
WINCOMMCTRLAPI HWND WINAPI CreateStatusWindow(LONG style, LPCSTR lpszText, HWND hwndParent, UINT wID);
#ifdef _WIN32
#define STATUSCLASSNAME "msctls_statusbar32"
#else
#define STATUSCLASSNAME "msctls_statusbar"
#endif
#define SB_SETTEXT (WM_USER+1)
#define SB_GETTEXT (WM_USER+2)
#define SB_GETTEXTLENGTH (WM_USER+3)
/* Just like WM_?ETTEXT*, with wParam specifying the pane that is referenced
* (at most 255).
* Note that you can use the WM_* versions to reference the 0th pane (this
* is useful if you want to treat a "default" status bar like a static text
* control).
* For SETTEXT, wParam is the pane or'ed with SBT_* style bits (defined below).
* If the text is "normal" (not OWNERDRAW), then a single pane may have left,
* center, and right justified text by separating the parts with a single tab,
* plus if lParam is NULL, then the pane has no text. The pane will be
* invalidated, but not draw until the next PAINT message.
* For GETTEXT and GETTEXTLENGTH, the LOWORD of the return will be the length,
* and the HIWORD will be the SBT_* style bits.
*/
#define SB_SETPARTS (WM_USER+4)
/* wParam is the number of panes, and lParam points to an array of points
* specifying the right hand side of each pane. A right hand side of -1 means
* it goes all the way to the right side of the control minus the X border
*/
#define SB_GETPARTS (WM_USER+6)
/* lParam is a pointer to an array of integers that will get filled in with
* the right hand side of each pane and wParam is the size (in integers)
* of the lParam array (so we do not go off the end of it).
* Returns the number of panes.
*/
#define SB_GETBORDERS (WM_USER+7)
/* lParam is a pointer to an array of 3 integers that will get filled in with
* the X border, the Y border, and the between pane border.
*/
#define SB_SETMINHEIGHT (WM_USER+8)
/* wParam is the minimum height of the status bar "drawing" area. This is
* the area inside the highlights. This is most useful if a pane is used
* for an OWNERDRAW item, and is ignored if the SBS_NORESIZE flag is set.
* Note that WM_SIZE (wParam=0, lParam=0L) must be sent to the control for
* any size changes to take effect.
*/
#define SB_SIMPLE (WM_USER+9)
/* wParam specifies whether to set (non-zero) or unset (zero) the "simple"
* mode of the status bar. In simple mode, only one pane is displayed, and
* its text is set with LOWORD(wParam)==255 in the SETTEXT message.
* OWNERDRAW is not allowed, but other styles are.
* The pane gets invalidated, but not painted until the next PAINT message,
* so you can set new text without flicker (I hope).
* This can be used with the WM_INITMENU and WM_MENUSELECT messages to
* implement help text when scrolling through a menu.
*/
#define SB_GETRECT (WM_USER + 10)
// wParam is the nth part
// lparam is lprc
// returns true if found a rect for wParam
#define SBT_OWNERDRAW 0x1000
/* The lParam of the SB_SETTEXT message will be returned in the DRAWITEMSTRUCT
* of the WM_DRAWITEM message. Note that the fields CtlType, itemAction, and
* itemState of the DRAWITEMSTRUCT are undefined for a status bar.
* The return value for GETTEXT will be the itemData.
*/
#define SBT_NOBORDERS 0x0100
/* No borders will be drawn for the pane.
*/
#define SBT_POPOUT 0x0200
/* The text pops out instead of in
*/
//
// MidEast languages only
#define SBT_RTLREADING 0x400
#endif /* NOSTATUSBAR */
/*/////////////////////////////////////////////////////////////////////////*/
#ifndef NOMENUHELP
WINCOMMCTRLAPI void WINAPI MenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu, HINSTANCE hInst, HWND hwndStatus, UINT FAR *lpwIDs);
WINCOMMCTRLAPI BOOL WINAPI ShowHideMenuCtl(HWND hWnd, UINT uFlags, LPINT lpInfo);
WINCOMMCTRLAPI void WINAPI GetEffectiveClientRect(HWND hWnd, LPRECT lprc, LPINT lpInfo);
/*REVIEW: is this internal? */
#define MINSYSCOMMAND SC_SIZE
#endif /* NOMENUHELP */
/*/////////////////////////////////////////////////////////////////////////*/
// slider control
#ifndef NOTRACKBAR
/*
This control keeps its ranges in LONGs. but for
convienence and symetry with scrollbars
WORD parameters are are used for some messages.
if you need a range in LONGs don't use any messages
that pack values into loword/hiword pairs
The trackbar messages:
message wParam lParam return
TBM_GETPOS ------ ------ Current logical position of trackbar.
TBM_GETRANGEMIN ------ ------ Current logical minimum position allowed.
TBM_GETRANGEMAX ------ ------ Current logical maximum position allowed.
TBM_SETTIC
TBM_SETPOS
TBM_SETRANGEMIN
TBM_SETRANGEMAX
*/
#ifdef _WIN32
#define TRACKBAR_CLASS "msctls_trackbar32"
#else
#define TRACKBAR_CLASS "msctls_trackbar"
#endif
/* Trackbar styles */
/* add ticks automatically on TBM_SETRANGE message */
#define TBS_AUTOTICKS 0x0001
#define TBS_VERT 0x0002 /* vertical trackbar */
#define TBS_HORZ 0x0000 /* default */
#define TBS_TOP 0x0004 /* Ticks on top */
#define TBS_BOTTOM 0x0000 /* Ticks on bottom (default) */
#define TBS_LEFT 0x0004 /* Ticks on left */
#define TBS_RIGHT 0x0000 /* Ticks on right (default) */
#define TBS_BOTH 0x0008 /* Ticks on both side */
#define TBS_NOTICKS 0x0010
#define TBS_ENABLESELRANGE 0x0020
#define TBS_FIXEDLENGTH 0x0040 /* specifies that the thumb will be of fixed size */
#define TBS_NOTHUMB 0x0080
/* Trackbar messages */
/* returns current position (LONG) */
#define TBM_GETPOS (WM_USER)
/* set the min of the range to LPARAM */
#define TBM_GETRANGEMIN (WM_USER+1)
/* set the max of the range to LPARAM */
#define TBM_GETRANGEMAX (WM_USER+2)
/* wParam is index of tick to get (ticks are in the range of min - max) */
#define TBM_GETTIC (WM_USER+3)
/* wParam is index of tick to set */
#define TBM_SETTIC (WM_USER+4)
/* set the position to the value of lParam (wParam is the redraw flag) */
#define TBM_SETPOS (WM_USER+5)
/* LOWORD(lParam) = min, HIWORD(lParam) = max, wParam == fRepaint */
#define TBM_SETRANGE (WM_USER+6)
/* lParam is range min (use this to keep LONG precision on range) */
#define TBM_SETRANGEMIN (WM_USER+7)
/* lParam is range max (use this to keep LONG precision on range) */
#define TBM_SETRANGEMAX (WM_USER+8)
/* remove the ticks */
#define TBM_CLEARTICS (WM_USER+9)
/* select a range LOWORD(lParam) min, HIWORD(lParam) max */
#define TBM_SETSEL (WM_USER+10)
/* set selection rang (LONG form) */
#define TBM_SETSELSTART (WM_USER+11)
#define TBM_SETSELEND (WM_USER+12)
/* return a pointer to the list of tics (DWORDS) */
#define TBM_GETPTICS (WM_USER+14)
/* get the pixel position of a given tick */
#define TBM_GETTICPOS (WM_USER+15)
/* get the number of tics */
#define TBM_GETNUMTICS (WM_USER+16)
/* get the selection range */
#define TBM_GETSELSTART (WM_USER+17)
#define TBM_GETSELEND (WM_USER+18)
/* clear the selection */
#define TBM_CLEARSEL (WM_USER+19)
/* set tic frequency */
#define TBM_SETTICFREQ (WM_USER+20)
/* Set/get the page size */
#define TBM_SETPAGESIZE (WM_USER+21) // lParam = lPageSize . Returns old pagesize
#define TBM_GETPAGESIZE (WM_USER+22)
/* Set/get the line size */
#define TBM_SETLINESIZE (WM_USER+23)
#define TBM_GETLINESIZE (WM_USER+24)
/* Get the thumb's and channel's rect size */
#define TBM_GETTHUMBRECT (WM_USER+25) // lParam = lprc . for return value
#define TBM_GETCHANNELRECT (WM_USER+26) // lParam = lprc . for return value
#define TBM_SETTHUMBLENGTH (WM_USER+27) // wParam = UINT size
#define TBM_GETTHUMBLENGTH (WM_USER+28)
/*REVIEW: these match the SB_ (scroll bar messages); define them that way? */
#define TB_LINEUP 0
#define TB_LINEDOWN 1
#define TB_PAGEUP 2
#define TB_PAGEDOWN 3
#define TB_THUMBPOSITION 4
#define TB_THUMBTRACK 5
#define TB_TOP 6
#define TB_BOTTOM 7
#define TB_ENDTRACK 8
#endif
/*/////////////////////////////////////////////////////////////////////////*/
#ifndef NODRAGLIST
typedef struct {
UINT uNotification;
HWND hWnd;
POINT ptCursor;
} DRAGLISTINFO, FAR *LPDRAGLISTINFO;
#define DL_BEGINDRAG (WM_USER+133)
#define DL_DRAGGING (WM_USER+134)
#define DL_DROPPED (WM_USER+135)
#define DL_CANCELDRAG (WM_USER+136)
#define DL_CURSORSET 0
#define DL_STOPCURSOR 1
#define DL_COPYCURSOR 2
#define DL_MOVECURSOR 3
#define DRAGLISTMSGSTRING "commctrl_DragListMsg"
WINCOMMCTRLAPI BOOL WINAPI MakeDragList(HWND hLB);
WINCOMMCTRLAPI void WINAPI DrawInsert(HWND handParent, HWND hLB, int nItem);
WINCOMMCTRLAPI int WINAPI LBItemFromPt(HWND hLB, POINT pt, BOOL bAutoScroll);
#endif /* NODRAGLIST */
/*/////////////////////////////////////////////////////////////////////////*/
// spinner control
#ifndef NOUPDOWN
/*
// OVERVIEW:
//
// The UpDown control is a simple pair of buttons which increment or
// decrement an integer value. The operation is similar to a vertical
// scrollbar; except that the control only has line-up and line-down
// functionality, and changes the current position automatically.
//
// The control also can be linked with a companion control, usually an
// "edit" control, to simplify dialog-box management. This companion is
// termed a "buddy" in this documentation. Any sibling HWND may be
// assigned as the control's buddy, or the control may be allowed to
// choose one automatically. Once chosen, the UpDown can size itself to
// match the buddy's right or left border, and/or automatically set the
// text of the buddy control to make the current position visible.
//
// ADDITIONAL NOTES:
//
// The "upper" and "lower" limits must not cover a range larger than 32,767
// positions. It is acceptable to have the range inverted, i.e., to have
// (lower > upper). The upper button always moves the current position
// towards the "upper" number, and the lower button always moves towards the
// "lower" number. If the range is zero (lower == upper), or the control
// is disabled (EnableWindow(hCtrl, FALSE)), the control draws grayed
// arrows in both buttons. The UDS_WRAP style makes the range cyclic; that
// is, the numbers will wrap once one end of the range is reached.
//
// The buddy window must have the same parent as the UpDown control.
//
// If either of the UDS_ALIGN* styles are used, the updown control will
// locate itself on the "inside" of the buddy by resizing the buddy
// accordingly. so the original size of the buddy will now emcompass
// both a slightly smaller buddy and the updown control.
//
// If the buddy window resizes, and the UDS_ALIGN* styles are used, it
// is necessary to send the UDM_SETBUDDY message to re-anchor the UpDown
// control on the appropriate border of the buddy window.
//
// The UDS_AUTOBUDDY style uses GetWindow(hCtrl, GW_HWNDPREV) to pick
// the best buddy window. In the case of a DIALOG resource, this will
// choose the previous control listed in the resource script. If the
// windows will change in Z-order, sending UDM_SETBUDDY with a NULL handle
// will pick a new buddy; otherwise the original auto-buddy choice is
// maintained.
//
// The UDS_SETBUDDYINT style uses its own SetDlgItemInt-style
// functionality to set the caption text of the buddy. All WIN.INI [Intl]
// values are honored by this routine.
//
// The UDS_ARROWKEYS style will subclass the buddy window, in order to steal
// the VK_UP and VK_DOWN arrow key messages.
//
// The UDS_HORZ sytle will draw the two buttons side by side with
// left and right arrows instead of up and down arrows. It will also
// send the WM_HSCROLL message instead
//
*/
#ifdef _WIN32
#define UPDOWN_CLASS "msctls_updown32"
#else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -