TVM_GETITEMRECT

This message retrieves the bounding rectangle for a tree view item and indicates whether the item is visible. You can send this message explicitly or by using the TreeView_GetItemRect macro.

At a Glance

Header file: Commctrl.h
Windows CE versions: 1.0 and later
Related macro: TreeView_GetItemRect

Syntax

  1. TVM_GETITEMRECT wParam = (WPARAM)(BOOL) fItemRect;
    lParam = (LPARAM)(RECT FAR*) prc;

Parameters

fItemRect

Boolean value that specifies the portion of the item for which to retrieve the bounding rectangle. If set to TRUE, the bounding rectangle includes only the text of the item. If set to FALSE, it includes the entire line that the item occupies in the tree view control.

prc

Pointer to a RECT structure that, when sending the message, contains the handle of the item to retrieve the rectangle for. For more information on how to place the item handle in this parameter, see the Remarks section. After returning from the message, this parameter contains the bounding rectangle. The coordinates are relative to the upper-left corner of the tree view control.

Return Values

TRUE indicates that the item is visible and the bounding rectangle was successfully retrieved. Otherwise, the message returns FALSE and does not retrieve the bounding rectangle.

Remarks

When sending this message, the prc parameter contains the handle of the item that the rectangle is being retrieved for. The handle is placed in prc as shown in the following code example:

RECT rc;
*(HTREEITEM*)&rc = hTreeItem;
SendMessage(hwndTreeView, TVM_GETITEMRECT, FALSE, (LPARAM)&rc);

See Also

RECT