4 class CListView
: public CWindow
8 HWND
Create(HWND hWndParent
, _U_RECT rect
, LPCTSTR szWindowName
= NULL
, DWORD dwStyle
= 0,
9 DWORD dwExStyle
= 0, _U_MENUorID MenuOrID
= 0U, LPVOID lpCreateParam
= NULL
)
11 m_hWnd
= ::CreateWindowEx(dwExStyle
,
17 rect
.m_lpRect
->right
- rect
.m_lpRect
->left
,
18 rect
.m_lpRect
->bottom
- rect
.m_lpRect
->top
,
21 _AtlBaseModule
.GetModuleInstance(),
27 void SetRedraw(BOOL redraw
)
29 SendMessage(WM_SETREDRAW
, redraw
);
32 BOOL
SetTextBkColor(COLORREF cr
)
34 return (BOOL
)SendMessage(LVM_SETTEXTBKCOLOR
, 0, cr
);
37 BOOL
SetBkColor(COLORREF cr
)
39 return (BOOL
)SendMessage(LVM_SETBKCOLOR
, 0, cr
);
42 BOOL
SetTextColor(COLORREF cr
)
44 return (BOOL
)SendMessage(LVM_SETTEXTCOLOR
, 0, cr
);
47 DWORD
SetExtendedListViewStyle(DWORD dw
, DWORD dwMask
= 0)
49 return (DWORD
)SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE
, dwMask
, dw
);
52 int InsertColumn(int iCol
, LV_COLUMN
* pcol
)
54 return (int)SendMessage(LVM_INSERTCOLUMN
, iCol
, reinterpret_cast<LPARAM
>(pcol
));
57 int InsertColumn(int iCol
, LPWSTR pszText
, int fmt
, int width
= -1, int iSubItem
= -1, int iImage
= -1, int iOrder
= -1)
59 LV_COLUMN column
= {0};
60 column
.mask
= LVCF_TEXT
|LVCF_FMT
;
61 column
.pszText
= pszText
;
65 column
.mask
|= LVCF_WIDTH
;
70 column
.mask
|= LVCF_SUBITEM
;
71 column
.iSubItem
= iSubItem
;
75 column
.mask
|= LVCF_IMAGE
;
76 column
.iImage
= iImage
;
80 column
.mask
|= LVCF_ORDER
;
81 column
.iOrder
= iOrder
;
83 return InsertColumn(iCol
, &column
);
86 int GetColumnWidth(int iCol
)
88 return (int)SendMessage(LVM_GETCOLUMNWIDTH
, iCol
);
91 HIMAGELIST
SetImageList(HIMAGELIST himl
, int iImageList
)
93 return (HIMAGELIST
)SendMessage(LVM_SETIMAGELIST
, iImageList
, reinterpret_cast<LPARAM
>(himl
));
96 int InsertItem(const LV_ITEM
* pitem
)
98 return (int)SendMessage(LVM_INSERTITEM
, 0, reinterpret_cast<LPARAM
>(pitem
));
101 BOOL
DeleteItem(int i
)
103 return (BOOL
)SendMessage(LVM_DELETEITEM
, i
, 0);
106 BOOL
GetItem(LV_ITEM
* pitem
)
108 return (BOOL
)SendMessage(LVM_GETITEM
, 0, reinterpret_cast<LPARAM
>(pitem
));
111 BOOL
SetItem(const LV_ITEM
* pitem
)
113 return (BOOL
)SendMessage(LVM_SETITEM
, 0, reinterpret_cast<LPARAM
>(pitem
));
116 BOOL
FindItem(int iStart
, const LV_FINDINFO
* plvfi
)
118 return (BOOL
)SendMessage(LVM_FINDITEM
, iStart
, (LPARAM
) plvfi
);
123 return SendMessage(LVM_GETITEMCOUNT
);
126 BOOL
DeleteAllItems()
128 return (BOOL
)SendMessage(LVM_DELETEALLITEMS
);
133 return (BOOL
)SendMessage(LVM_UPDATE
, i
, 0);
136 UINT
GetSelectedCount()
138 return (UINT
)SendMessage(LVM_GETSELECTEDCOUNT
);
141 BOOL
SortItems(PFNLVCOMPARE pfnCompare
, PVOID lParam
)
143 return (BOOL
)SendMessage(LVM_SORTITEMS
, (WPARAM
)lParam
, (LPARAM
) pfnCompare
);
146 BOOL
EnsureVisible(int i
, BOOL fPartialOK
)
148 return (BOOL
)SendMessage(LVM_ENSUREVISIBLE
, i
, MAKELPARAM((fPartialOK
),0));
151 HWND
EditLabel(int i
)
153 return (HWND
)SendMessage(LVM_EDITLABEL
, i
, 0);
156 int GetSelectionMark()
158 return (int)SendMessage(LVM_GETSELECTIONMARK
);
161 int GetNextItem(int i
, WORD flags
)
163 return (int)SendMessage(LVM_GETNEXTITEM
, i
, MAKELPARAM((flags
),0));
166 void GetItemSpacing(SIZE
& spacing
, BOOL bSmallIconView
= FALSE
)
168 DWORD ret
= SendMessage(LVM_GETITEMSPACING
, bSmallIconView
);
169 spacing
.cx
= LOWORD(ret
);
170 spacing
.cy
= HIWORD(ret
);
173 UINT
GetItemState(int i
, UINT mask
)
175 return SendMessage(LVM_GETITEMSTATE
, i
, (LPARAM
)mask
);
178 void SetItemState(int i
, UINT state
, UINT mask
)
181 item
.stateMask
= mask
;
183 SendMessage(LVM_SETITEMSTATE
, i
, reinterpret_cast<LPARAM
>(&item
));
186 BOOL
SetItemText(int i
, int subItem
, LPCWSTR text
)
189 item
.iSubItem
= subItem
;
190 item
.pszText
= (LPWSTR
)text
;
191 return SendMessage(LVM_SETITEMTEXT
, i
, (LPARAM
)&item
);
194 void SetCheckState(int i
, BOOL check
)
196 SetItemState(i
, INDEXTOSTATEIMAGEMASK((check
)?2:1), LVIS_STATEIMAGEMASK
);
199 int HitTest(LV_HITTESTINFO
* phtInfo
)
201 return (int)SendMessage(LVM_HITTEST
, 0, reinterpret_cast<LPARAM
>(phtInfo
));
204 DWORD_PTR
GetItemData(int i
)
206 LVITEMW lvItem
= { 0 };
207 lvItem
.mask
= LVIF_PARAM
;
209 BOOL ret
= GetItem(&lvItem
);
210 return (DWORD_PTR
)(ret
? lvItem
.lParam
: NULL
);
213 BOOL
GetSelectedItem(LV_ITEM
* pItem
)
215 pItem
->iItem
= GetNextItem(-1, LVNI_ALL
| LVNI_SELECTED
);
216 if (pItem
->iItem
== -1)
218 return GetItem(pItem
);
221 void GetItemText(int iItem
, int iSubItem
, LPTSTR pszText
, int cchTextMax
)
224 itemInfo
.iSubItem
= iSubItem
;
225 itemInfo
.pszText
= pszText
;
226 itemInfo
.cchTextMax
= cchTextMax
;
228 SendMessage(LVM_GETITEMTEXT
, iItem
, (LPARAM
) &itemInfo
);
231 BOOL
GetItemPosition(int nItem
, POINT
* pPoint
)
233 return (BOOL
)SendMessage(LVM_GETITEMPOSITION
, nItem
, (LPARAM
)pPoint
);
236 BOOL
SetItemPosition(int nItem
, POINT
* pPoint
)
238 return (BOOL
)SendMessage(LVM_SETITEMPOSITION
, nItem
, MAKELPARAM(pPoint
->x
, pPoint
->y
));
241 BOOL
Arrange(UINT nCode
)
243 return (BOOL
)SendMessage(LVM_ARRANGE
, nCode
, 0);
248 template<typename TItemData
= DWORD_PTR
>
252 public: // Configuration methods
254 HWND
Create(HWND hWndParent
, DWORD dwStyles
= 0, DWORD dwExStyles
= 0)
258 dwStyles
= WS_CHILD
| WS_VISIBLE
| WS_CLIPCHILDREN
;
263 dwExStyles
= WS_EX_TOOLWINDOW
;
266 m_hWnd
= CreateWindowExW(dwExStyles
,
270 0, 0, 0, 0, hWndParent
,
272 _AtlBaseModule
.GetModuleInstance(),
278 /* Identify the version we're using */
279 SetButtonStructSize();
284 DWORD
SetButtonStructSize()
286 return SendMessageW(TB_BUTTONSTRUCTSIZE
, sizeof(TBBUTTON
), 0);
291 return (HWND
)SendMessageW(TB_GETTOOLTIPS
);
294 DWORD
SetTooltip(HWND hWndTooltip
)
296 return SendMessageW(TB_SETTOOLTIPS
, reinterpret_cast<WPARAM
>(hWndTooltip
), 0);
301 return SendMessageW(TB_GETHOTITEM
);
304 DWORD
SetHotItem(INT item
)
306 return SendMessageW(TB_SETHOTITEM
, item
);
309 public: // Button list management methods
312 return SendMessageW(TB_BUTTONCOUNT
);
315 DWORD
GetButton(int index
, TBBUTTON
* btn
)
317 return SendMessageW(TB_GETBUTTON
, index
, reinterpret_cast<LPARAM
>(btn
));
320 DWORD
AddButton(TBBUTTON
* btn
)
322 return SendMessageW(TB_ADDBUTTONS
, 1, reinterpret_cast<LPARAM
>(btn
));
325 DWORD
AddButtons(int count
, TBBUTTON
* buttons
)
327 return SendMessageW(TB_ADDBUTTONS
, count
, reinterpret_cast<LPARAM
>(buttons
));
330 DWORD
InsertButton(int insertAt
, TBBUTTON
* btn
)
332 return SendMessageW(TB_INSERTBUTTON
, insertAt
, reinterpret_cast<LPARAM
>(btn
));
335 DWORD
MoveButton(int oldIndex
, int newIndex
)
337 return SendMessageW(TB_MOVEBUTTON
, oldIndex
, newIndex
);
340 DWORD
DeleteButton(int index
)
342 return SendMessageW(TB_DELETEBUTTON
, index
, 0);
345 DWORD
GetButtonInfo(int cmdId
, TBBUTTONINFO
* info
)
347 return SendMessageW(TB_GETBUTTONINFO
, cmdId
, reinterpret_cast<LPARAM
>(info
));
350 DWORD
SetButtonInfo(int cmdId
, TBBUTTONINFO
* info
)
352 return SendMessageW(TB_SETBUTTONINFO
, cmdId
, reinterpret_cast<LPARAM
>(info
));
355 DWORD
CheckButton(int cmdId
, BOOL bCheck
)
357 return SendMessageW(TB_CHECKBUTTON
, cmdId
, MAKELPARAM(bCheck
, 0));
360 public: // Layout management methods
361 DWORD
GetButtonSize()
363 return SendMessageW(TB_GETBUTTONSIZE
);
366 DWORD
SetButtonSize(int w
, int h
)
368 return SendMessageW(TB_SETBUTTONSIZE
, 0, MAKELPARAM(w
, h
));
373 return SendMessageW(TB_AUTOSIZE
);
376 DWORD
GetMaxSize(LPSIZE size
)
378 return SendMessageW(TB_GETMAXSIZE
, 0, reinterpret_cast<LPARAM
>(size
));
381 DWORD
GetIdealSize(BOOL useHeight
, LPSIZE size
)
383 return SendMessageW(TB_GETIDEALSIZE
, useHeight
, reinterpret_cast<LPARAM
>(size
));
386 DWORD
GetMetrics(TBMETRICS
* tbm
)
388 return SendMessageW(TB_GETMETRICS
, 0, reinterpret_cast<LPARAM
>(tbm
));
391 DWORD
SetMetrics(TBMETRICS
* tbm
)
393 return SendMessageW(TB_SETMETRICS
, 0, reinterpret_cast<LPARAM
>(tbm
));
396 DWORD
GetItemRect(int index
, LPRECT prcItem
)
398 return SendMessageW(TB_GETITEMRECT
, index
, reinterpret_cast<LPARAM
>(prcItem
));
401 DWORD
SetRedraw(BOOL bEnable
)
403 return SendMessageW(WM_SETREDRAW
, bEnable
);
408 return SendMessageW(TB_GETPADDING
);
411 DWORD
SetPadding(int x
, int y
)
413 return SendMessageW(TB_SETPADDING
, 0, MAKELPARAM(x
, y
));
416 public: // Image list management methods
417 HIMAGELIST
SetImageList(HIMAGELIST himl
)
419 return (HIMAGELIST
)SendMessageW(TB_SETIMAGELIST
, 0, reinterpret_cast<LPARAM
>(himl
));
422 public: // Other methods
423 INT
HitTest(PPOINT ppt
)
425 return (INT
) SendMessageW(TB_HITTEST
, 0, reinterpret_cast<LPARAM
>(ppt
));
428 public: // Utility methods
429 TItemData
* GetItemData(int index
)
432 GetButton(index
, &btn
);
433 return (TItemData
*) btn
.dwData
;
436 DWORD
SetItemData(int index
, TItemData
* data
)
438 TBBUTTONINFOW info
= { 0 };
439 info
.cbSize
= sizeof(info
);
440 info
.dwMask
= TBIF_BYINDEX
| TBIF_LPARAM
;
441 info
.lParam
= (DWORD_PTR
) data
;
442 return SetButtonInfo(index
, &info
);
450 VOID
SetText(LPCWSTR lpszText
)
452 SendMessage(SB_SETTEXT
, SBT_NOBORDERS
, (LPARAM
) lpszText
);
455 HWND
Create(HWND hwndParent
, HMENU hMenu
)
457 m_hWnd
= CreateWindowExW(0,
460 WS_CHILD
| WS_VISIBLE
| SBARS_SIZEGRIP
,
464 _AtlBaseModule
.GetModuleInstance(),
476 HWND
Create(HWND hwndParent
)
478 m_hWnd
= CreateWindowExW(WS_EX_CLIENTEDGE
,
481 WS_CHILD
| WS_VISIBLE
| TVS_HASLINES
| TVS_SHOWSELALWAYS
,
485 _AtlBaseModule
.GetModuleInstance(),
491 HTREEITEM
AddItem(HTREEITEM hParent
, LPWSTR lpText
, INT Image
, INT SelectedImage
, LPARAM lParam
)
493 TVINSERTSTRUCTW Insert
;
495 ZeroMemory(&Insert
, sizeof(TV_INSERTSTRUCT
));
497 Insert
.item
.mask
= TVIF_TEXT
| TVIF_PARAM
| TVIF_IMAGE
| TVIF_SELECTEDIMAGE
;
498 Insert
.hInsertAfter
= TVI_LAST
;
499 Insert
.hParent
= hParent
;
500 Insert
.item
.iSelectedImage
= SelectedImage
;
501 Insert
.item
.iImage
= Image
;
502 Insert
.item
.lParam
= lParam
;
503 Insert
.item
.pszText
= lpText
;
505 return InsertItem(&Insert
);
508 void SetRedraw(BOOL redraw
)
510 SendMessage(WM_SETREDRAW
, redraw
);
513 BOOL
SetBkColor(COLORREF cr
)
515 return (BOOL
) SendMessage(TVM_SETBKCOLOR
, 0, cr
);
518 BOOL
SetTextColor(COLORREF cr
)
520 return (BOOL
) SendMessage(TVM_SETTEXTCOLOR
, 0, cr
);
523 HIMAGELIST
SetImageList(HIMAGELIST himl
, int iImageList
)
525 return (HIMAGELIST
) SendMessage(TVM_SETIMAGELIST
, iImageList
, reinterpret_cast<LPARAM
>(himl
));
528 HTREEITEM
InsertItem(const TVINSERTSTRUCTW
* pitem
)
530 return (HTREEITEM
) SendMessage(TVM_INSERTITEM
, 0, reinterpret_cast<LPARAM
>(pitem
));
533 BOOL
DeleteItem(HTREEITEM i
)
535 return (BOOL
) SendMessage(TVM_DELETEITEM
, 0, (LPARAM
)i
);
538 BOOL
GetItem(TV_ITEM
* pitem
)
540 return (BOOL
) SendMessage(TVM_GETITEM
, 0, reinterpret_cast<LPARAM
>(pitem
));
543 BOOL
SetItem(const TV_ITEM
* pitem
)
545 return (BOOL
) SendMessage(TVM_SETITEM
, 0, reinterpret_cast<LPARAM
>(pitem
));
550 return SendMessage(TVM_GETCOUNT
);
553 BOOL
EnsureVisible(HTREEITEM i
)
555 return (BOOL
) SendMessage(TVM_ENSUREVISIBLE
, 0, (LPARAM
)i
);
558 HWND
EditLabel(HTREEITEM i
)
560 return (HWND
) SendMessage(TVM_EDITLABEL
, 0, (LPARAM
)i
);
563 HTREEITEM
GetNextItem(HTREEITEM i
, WORD flags
)
565 return (HTREEITEM
)SendMessage(TVM_GETNEXTITEM
, flags
, (LPARAM
)i
);
568 UINT
GetItemState(int i
, UINT mask
)
570 return SendMessage(TVM_GETITEMSTATE
, i
, (LPARAM
) mask
);
573 HTREEITEM
HitTest(TVHITTESTINFO
* phtInfo
)
575 return (HTREEITEM
) SendMessage(TVM_HITTEST
, 0, reinterpret_cast<LPARAM
>(phtInfo
));
578 DWORD_PTR
GetItemData(HTREEITEM item
)
582 lvItem
.mask
= TVIF_PARAM
;
583 BOOL ret
= GetItem(&lvItem
);
584 return (DWORD_PTR
) (ret
? lvItem
.lParam
: NULL
);
587 HTREEITEM
GetSelection()
589 return GetNextItem(NULL
, TVGN_CARET
);
592 BOOL
Expand(HTREEITEM item
, DWORD action
)
594 return SendMessage(TVM_EXPAND
, action
, (LPARAM
)item
);
597 BOOL
SelectItem(HTREEITEM item
, DWORD action
= TVGN_CARET
)
599 return SendMessage(TVM_SELECTITEM
, action
, (LPARAM
) item
);
607 public: // Configuration methods
609 HWND
Create(HWND hWndParent
, DWORD dwStyles
= WS_POPUP
| TTS_NOPREFIX
, DWORD dwExStyles
= WS_EX_TOPMOST
)
612 return CWindow::Create(TOOLTIPS_CLASS
, hWndParent
, r
, L
"", dwStyles
, dwExStyles
);
615 public: // Relay event
617 // Win7+: Can use GetMessageExtraInfo to provide the WPARAM value.
618 VOID
RelayEvent(MSG
* pMsg
, WPARAM extraInfo
= 0)
620 SendMessageW(TTM_RELAYEVENT
, extraInfo
, reinterpret_cast<LPARAM
>(pMsg
));
627 return SendMessageW(TTM_GETTOOLCOUNT
, 0, 0);
630 BOOL
AddTool(IN CONST TTTOOLINFOW
* pInfo
)
632 return SendMessageW(TTM_ADDTOOL
, 0, reinterpret_cast<LPARAM
>(pInfo
));
635 VOID
DelTool(IN HWND hwndToolOwner
, IN UINT uId
)
637 TTTOOLINFOW info
= { sizeof(TTTOOLINFOW
), 0 };
638 info
.hwnd
= hwndToolOwner
;
640 SendMessageW(TTM_DELTOOL
, 0, reinterpret_cast<LPARAM
>(&info
));
643 VOID
NewToolRect(IN HWND hwndToolOwner
, IN UINT uId
, IN RECT rect
)
645 TTTOOLINFOW info
= { sizeof(TTTOOLINFOW
), 0 };
646 info
.hwnd
= hwndToolOwner
;
649 SendMessageW(TTM_NEWTOOLRECT
, 0, reinterpret_cast<LPARAM
>(&info
));
652 BOOL
GetToolInfo(IN HWND hwndToolOwner
, IN UINT uId
, IN OUT TTTOOLINFOW
* pInfo
)
654 pInfo
->hwnd
= hwndToolOwner
;
656 return SendMessageW(TTM_GETTOOLINFO
, 0, reinterpret_cast<LPARAM
>(pInfo
));
659 VOID
SetToolInfo(IN CONST TTTOOLINFOW
* pInfo
)
661 SendMessageW(TTM_SETTOOLINFO
, 0, reinterpret_cast<LPARAM
>(pInfo
));
664 BOOL
HitTest(IN CONST TTHITTESTINFOW
* pInfo
)
666 return SendMessageW(TTM_HITTEST
, 0, reinterpret_cast<LPARAM
>(pInfo
));
669 VOID
GetText(IN HWND hwndToolOwner
, IN UINT uId
, OUT PWSTR pBuffer
, IN DWORD cchBuffer
)
671 TTTOOLINFOW info
= { sizeof(TTTOOLINFOW
), 0 };
672 info
.hwnd
= hwndToolOwner
;
674 info
.lpszText
= pBuffer
;
675 SendMessageW(TTM_GETTEXT
, cchBuffer
, reinterpret_cast<LPARAM
>(&info
));
678 VOID
UpdateTipText(IN HWND hwndToolOwner
, IN UINT uId
, IN PCWSTR szText
, IN HINSTANCE hinstResourceOwner
= NULL
)
680 TTTOOLINFOW info
= { sizeof(TTTOOLINFOW
), 0 };
681 info
.hwnd
= hwndToolOwner
;
683 info
.lpszText
= const_cast<PWSTR
>(szText
);
684 info
.hinst
= hinstResourceOwner
;
685 SendMessageW(TTM_UPDATETIPTEXT
, 0, reinterpret_cast<LPARAM
>(&info
));
688 BOOL
EnumTools(IN CONST TTTOOLINFOW
* pInfo
)
690 return SendMessageW(TTM_ENUMTOOLS
, 0, reinterpret_cast<LPARAM
>(pInfo
));
693 BOOL
GetCurrentTool(OUT OPTIONAL TTTOOLINFOW
* pInfo
= NULL
)
695 return SendMessageW(TTM_GETCURRENTTOOL
, 0, reinterpret_cast<LPARAM
>(pInfo
));
698 VOID
GetTitle(TTGETTITLE
* pTitleInfo
)
700 SendMessageW(TTM_GETTITLE
, 0, reinterpret_cast<LPARAM
>(pTitleInfo
));
703 BOOL
SetTitle(PCWSTR szTitleText
, WPARAM icon
= 0)
705 return SendMessageW(TTM_SETTITLE
, icon
, reinterpret_cast<LPARAM
>(szTitleText
));
708 VOID
TrackActivate(IN HWND hwndToolOwner
, IN UINT uId
)
710 TTTOOLINFOW info
= { sizeof(TTTOOLINFOW
), 0 };
711 info
.hwnd
= hwndToolOwner
;
713 SendMessageW(TTM_TRACKACTIVATE
, TRUE
, reinterpret_cast<LPARAM
>(&info
));
716 VOID
TrackDeactivate()
718 SendMessageW(TTM_TRACKACTIVATE
, FALSE
, NULL
);
721 VOID
TrackPosition(IN WORD x
, IN WORD y
)
723 SendMessageW(TTM_TRACKPOSITION
, 0, MAKELPARAM(x
, y
));
729 SendMessageW(TTM_POPUP
);
732 // Closes the tooltip - Pressing the [X] for a TTF_CLOSE balloon is equivalent to calling this
735 SendMessageW(TTM_POP
);
738 // Delay times for AUTOMATIC tooltips (they don't affect balloons)
739 INT
GetDelayTime(UINT which
)
741 return SendMessageW(TTM_GETDELAYTIME
, which
);
744 VOID
SetDelayTime(UINT which
, WORD time
)
746 SendMessageW(TTM_SETDELAYTIME
, which
, MAKELPARAM(time
, 0));
749 // Activates or deactivates the automatic tooltip display when hovering a control
750 VOID
Activate(IN BOOL bActivate
= TRUE
)
752 SendMessageW(TTM_ACTIVATE
, bActivate
);
755 // Adjusts the position of a tooltip when used to display trimmed text
756 VOID
AdjustRect(IN BOOL bTextToWindow
, IN OUT RECT
* pRect
)
758 SendMessageW(TTM_ADJUSTRECT
, bTextToWindow
, reinterpret_cast<LPARAM
>(pRect
));
761 // Useful for TTF_ABSOLUTE|TTF_TRACK tooltip positioning
762 SIZE
GetBubbleSize(IN TTTOOLINFOW
* pInfo
)
764 DWORD ret
= SendMessageW(TTM_GETBUBBLESIZE
, 0, reinterpret_cast<LPARAM
>(pInfo
));
765 const SIZE sz
= { LOWORD(ret
), HIWORD(ret
) };
769 // Fills the RECT with the margin size previously set. Default is 0 margins.
770 VOID
GetMargin(OUT RECT
* pRect
)
772 SendMessageW(TTM_GETMARGIN
, 0, reinterpret_cast<LPARAM
>(pRect
));
775 VOID
SetMargin(IN RECT
* pRect
)
777 SendMessageW(TTM_SETMARGIN
, 0, reinterpret_cast<LPARAM
>(pRect
));
780 // Gets a previously established max width. Returns -1 if no limit is set
783 return SendMessageW(TTM_GETMAXTIPWIDTH
);
786 INT
SetMaxTipWidth(IN OPTIONAL INT width
= -1)
788 return SendMessageW(TTM_SETMAXTIPWIDTH
, 0, width
);
791 // Get the color of the tooltip text
792 COLORREF
GetTipTextColor()
794 return SendMessageW(TTM_GETTIPTEXTCOLOR
);
797 VOID
SetTipTextColor(IN COLORREF textColor
)
799 SendMessageW(TTM_SETTIPTEXTCOLOR
, textColor
);
802 COLORREF
GetTipBkColor()
804 return SendMessageW(TTM_GETTIPBKCOLOR
);
807 VOID
SetTipBkColor(IN COLORREF textColor
)
809 SendMessageW(TTM_SETTIPBKCOLOR
, textColor
);
812 VOID
SetWindowTheme(IN PCWSTR szThemeName
)
814 SendMessageW(TTM_SETWINDOWTHEME
, 0, reinterpret_cast<LPARAM
>(szThemeName
));
820 SendMessageW(TTM_UPDATE
);
823 HWND
WindowFromPoint(IN POINT
* pPoint
)
825 return reinterpret_cast<HWND
>(SendMessageW(TTM_WINDOWFROMPOINT
, 0, reinterpret_cast<LPARAM
>(pPoint
)));