HeaderPane
Main
Hide
Share Link
Print

CalcCellFromPoint

Calculates the item index and column number given a point in combo box control client area coordinates.

C

BOOL WINAPI SftBox_CalcCellFromPoint(HWND hwndCtl, LPPOINT lpPt, LONG* lpIndex, int* lpCol, BOOL* lpfMain);

C++

BOOL CSftBox::CalcCellFromPoint(LPPOINT lpPt, LONG* lpIndex, int* lpCol, BOOL* lpfMain) const;

Parameters

hwndCtl

The window handle of the combo box control.

lpPt

The x and y coordinates in pixels (relative to the upper left corner of the combo box control's client area), for which the item index and column number need to be calculated. A location in the dropdown portion is also described relative to the combo box control's client area.

lpIndex

A pointer to a variable where the zero-based item index is returned.

lpCol

A pointer to a variable where the zero-based column number is returned.

lpfMain

A pointer to a variable which receives a value indicating the portion of the combo box control where the point is located. TRUE is returned if the point is located in the static portion (or the edit control portion), FALSE is returned if the point is located in the dropdown portion or outside of both. This parameter cannot be NULL.

Returns

The return value is TRUE if the function was successful, otherwise FALSE.

Comments

The CalcCellFromPoint function calculates the item index and column number given a point in combo box control client area coordinates.

The dropdown portion is tested first. If the location lpPt is in a cell of the dropdown portion, the item index and column number of the cell are returned.

If the location lpPt is in a cell of the static portion (or of the edit control portion of a simple or dropdown combo box), the index returned is the index of the currently selected item (see GetCurSel), as this portion shows the selected item. If no item is selected, the static portion contains no cells and FALSE is returned.

If the location lpPt is not located in a cell, FALSE is returned and the variables addressed by lpIndex and lpCol are not modified.

Use CalcIndexFromPoint to determine the item index only.

See Also C/C++ API | Categories | Notifications


Last Updated 11/21/2026 - (email)
© 2026 Softel vdm, Inc.