Returns a cell's location.
C
LPRECT WINAPI SftBox_GetCellRect(HWND hwndCtl, BOOL fMain, LONG index, int col);
C++
LPRECT CSftBox::GetCellRect(BOOL fMain, LONG index, int col) const;
hwndCtl
The window handle of the combo box control.
fMain
Set to TRUE to retrieve the location of a cell of the selected item shown in the static portion. Set to FALSE to retrieve the location of a cell in the dropdown portion.
index
The zero-based index of the item. Specify -1 for the currently selected item. If fMain is TRUE, index must be -1 or the index of the currently selected item, because the static portion only shows the selected item.
col
The zero-based column number of the cell. If a negative value is specified, the column where a mouse button was last clicked is used (see GetCaretColumn).
The return value is a pointer to a RECT structure with the location of the cell. NULL is returned if the location cannot be retrieved.
The GetCellRect function returns a cell's location.
If fMain is TRUE, the returned coordinates are relative to the upper-left corner of the static portion. If fMain is FALSE, the returned coordinates are client area coordinates of the dropdown portion (see GetHWNDDropDown). The rectangle is clipped to the visible area and is adjusted for horizontal scrolling.
The location of a cell in the dropdown portion can only be retrieved while the dropdown portion is shown (see GetDroppedState), otherwise NULL is returned. NULL is also returned if fMain is TRUE and index describes an item other than the currently selected item, if index is -1 and no item is selected, if the item is not currently displayed (see GetItemRect), or if the item or column does not exist.
The returned pointer addresses a RECT structure which is owned by the combo box. The structure is overwritten by the next call to GetCellRect and is no longer valid once the combo box is destroyed. An application must not free the structure and should copy its contents if they are needed later.
GetItemRect returns the location of an entire item.
See Also C/C++ API | Categories | Notifications