I'm unable to use my mouse to select any item from a combobox control placed on a modeless dialog box. I can very well do it with the keyboard but there still is a problem.
When I've dropped the combobox list down, I cannot move my main window (i.e. the modeless dialog).
Here is my code:
Code:
#include <afxwin.h>
#include <tchar.h>
#include "resource.h"
BOOL CALLBACK
DlgProc(
HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam
);
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
MSG msg;
HWND hDlg;
hDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc);
if (NULL == hDlg)
{
MessageBox(NULL, _T("CreateDialog...FAILED."), 0, 0);
return 0;
}
ShowWindow(hDlg, SW_SHOW);
UpdateWindow(hDlg);
while (GetMessage (&msg, NULL, 0, 0))
{
IsDialogMessage(hDlg, &msg);
}
return msg.wParam;
}
BOOL CALLBACK
DlgProc(
HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam
)
{
HWND hDlgCtrl;
CComboBox cmbOb;
switch (message)
{
case WM_INITDIALOG:
hDlgCtrl = GetDlgItem(hwnd, IDC_CMB_TEST);
cmbOb.Attach(hDlgCtrl);
cmbOb.AddString("str 1");
cmbOb.AddString("str 2");
cmbOb.SetCurSel(0);
cmbOb.Detach();
return TRUE;
case WM_CLOSE:
DestroyWindow(hwnd);
return TRUE;
case WM_DESTROY:
PostQuitMessage(0);
return TRUE;
}
return FALSE;
}
