Gentle people,
I simply just don't understand ...
There is a Combobox child window. If I set the focus to this combobox, I can enter the desired text and it is shown in the box, but I am unable to check whether the user has completed his entry. I.e. I get all CB notifications under WM_COMMAND, but none in WM_CHAR or WM_KEYDOWN. On the other hand if I inactivate the SetFocus to this combobox, I am unable to enter text. I.e. I get none of the CB notifications under WM_COMMAND, but WM_CHAR or WM_KEYDOWN work well ...
Could somebody please explain and give me an idea how to proceed? Any help will be appreciated!
The following simple piece of code already shows this behaviour:
int APIENTRY _tWinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{ :
:
:
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
hWnd = CreateWindow (szWindowClass,szTitle,
WS_TILED | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU,
100,100,905,667,NULL,NULL,hInstance,NULL);
LoadString(hInstance, IDC_CMB, szClass, MAX_LOADSTRING);
hListtitel = CreateWindow(szClass,"",
WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | _VSCROLL,
200, 170, 540, 400,hWnd,NULL,hInstance,NULL);
InvalidateRect(hWnd,NULL,TRUE);
ShowWindow(hWnd, SW_SHOWNORMAL);
UpdateWindow(hWnd);
SetFocus(hListtitel); <----------------------------------
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{ :
:
:
case WM_CHAR:
break;
:
:
:
case WM_COMMAND:
wmEvent = HIWORD(wParam);
if ((hListtitel != 0) && (lParam == (LPARAM)hListtitel))
{
switch (wmEvent)
{
case CBN_EDITUPDATE:
break;
case CBN_KILLFOCUS:
break;
case CBN_SELCHANGE:
break;
}
break;
}
}
return DefWindowProc(hWnd, message, wParam, lParam);
}