HeaderPane
Main
Hide
Share Link
Print

NM_SFTBOX_KEYDOWN Structure

The NM_SFTBOX_KEYDOWN structure is sent to the parent window with a WM_NOTIFY message (notification code NM_SFTBOX_KEYDOWN_CODE) when a key is pressed while the combo box control has the input focus.

#define NM_SFTBOX_KEYDOWN_CODE                  100

typedef struct {
    NMHDR hdr;
    BOOL fEdit;
    UINT vk;
    int cRepeat;
    UINT flags;
    BOOL fHandled;                          // modifiable
} NM_SFTBOX_KEYDOWN;

Members

hdr

The standard WM_NOTIFY notification header. hwndFrom contains the window handle of the combo box control, idFrom contains the control ID of the combo box control and code is set to NM_SFTBOX_KEYDOWN_CODE.

fEdit

TRUE if the combo box control has an edit control portion (simple combo box and dropdown combo box), in which case the key is about to be processed by the edit control portion. FALSE for a dropdown list combo box.

vk

The virtual-key code of the key that was pressed (the wParam value of the WM_KEYDOWN message).

cRepeat

The repeat count (the low-order word of the lParam value of the WM_KEYDOWN message).

flags

The scan code, extended-key flag, context code, previous key-state flag and transition-state flag (the high-order word of the lParam value of the WM_KEYDOWN message).

fHandled

Modifiable. The combo box control sets this member to FALSE before sending the notification. An application can set fHandled to TRUE to indicate that it has handled the key. In this case, the combo box control ignores the key. It is not used to change the selection or to drop down or close the dropdown portion and it is not passed on to the edit control portion. If fHandled remains FALSE, the key is processed normally. h1 Comments

The combo box control sends the WM_NOTIFY message with the NM_SFTBOX_KEYDOWN structure to its parent window for each WM_KEYDOWN message it receives, before the key is processed. The wParam value of the WM_NOTIFY message contains the control ID of the combo box control, the lParam value contains a pointer to the NM_SFTBOX_KEYDOWN structure.

The notification is not sent for system keys (WM_SYSKEYDOWN), for example Alt+Down.

Setting fHandled to TRUE suppresses the key down processing only. Windows still generates a WM_CHAR message for a character key, which is reported using the NM_SFTBOX_CHAR structure. The matching key up is reported using the NM_SFTBOX_KEYUP structure.

case WM_NOTIFY: {
    LPNMHDR lpnmh = (LPNMHDR) lParam;
    if (lpnmh->idFrom == IDC_COMBO && lpnmh->code == NM_SFTBOX_KEYDOWN_CODE) {
        NM_SFTBOX_KEYDOWN * lpKey = (NM_SFTBOX_KEYDOWN *) lParam;
        if (lpKey->vk == VK_F4)
            lpKey->fHandled = TRUE;     // the combo box ignores F4
    }
    break;
 }

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


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