How to Process ComboBoxEx Notifications
This topic demonstrates how to process ComboBoxEx notification messages.
What you need to know
Technologies
Prerequisites
- C/C++
- Windows User Interface Programming
Instructions
A ComboBoxEx control notifies its parent window of events by sending WM_NOTIFY messages. It also passes the WM_COMMAND notification messages that it receives from the combo box contained within it to the parent window to be processed. Therefore, your application must be prepared to process WM_NOTIFY messages from the ComboBoxEx and WM_COMMAND messages that are forwarded from the ComboBoxEx child combo box control.
The example in this section handles the WM_NOTIFY and WM_COMMAND messages from a ComboBoxEx control by calling a corresponding application-defined function to process these messages.
Complete example
LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg){
case WM_COMMAND: // notification from the child ComboBox within the ComboBoxEx control.
if((HWND)lParam == g_hwndCB)
DoOldNotify(hwnd, wParam);
break;
case WM_NOTIFY: // notification from the ComboBoxEx control
return (DoCBEXNotify(hwnd, lParam));
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
EndPaint(hwnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
break;
}
return FALSE;
}
Related topics