indiocolifa
January 19th, 2004, 11:28 PM
I'm stuck with a stupid problem: my modal dialog box does not appear. I'm very comfortable with the Win32 API but I think i'm in a bad day...
Here's the code (note that I'm using message crackers from WINDOWSX.H):
//
// helpDlg Dialog Procedure
//
BOOL CALLBACK helpDlg_DlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
HANDLE_MSG (hwndDlg, WM_INITDIALOG, helpDlg_OnInitDialog);
//// TODO: Add dialog message crackers here...
default:
return FALSE;
}
}
and WM_INITDIALOG handler...
//
// Process WM_INITDIALOG message for window/dialog: helpDlg
//
BOOL helpDlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
// fill the listbox
int itemdx;
// first clear all items if any
SendDlgItemMessage(hwnd, IDC_MESSAGES, LB_RESETCONTENT, 0, 0);
// add messages to listbox
for (int i = 0; i < numMessages; i++)
itemdx = (int)SendDlgItemMessage (hwnd, IDC_CBOMSG, LB_ADDSTRING, 0, (LPARAM)msginfo[i].WM_msg);
return FALSE;
}
and the function where it's called...
//
// process WM_ONCOMMAND
//
void Cls_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
HMENU hMenu;
BYTE bAlpha; // window transparency alpha
HMODULE hUser32;
PSLWA pSetLayeredWndAttr;
switch (id)
{
// menus
case ID_HELP_ABOUT:
DialogBox(GetModuleHandle(0), MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlg_DlgProc);
break;
case ID_HELP_MESSAGEHELP: // hereĦs where i call the dlg which does not appear!
DialogBox(GetModuleHandle(0), MAKEINTRESOURCE(IDD_HELPWINDOW), hwnd, helpDlg_DlgProc);
break;
...
some clues?
thanks.
Here's the code (note that I'm using message crackers from WINDOWSX.H):
//
// helpDlg Dialog Procedure
//
BOOL CALLBACK helpDlg_DlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
HANDLE_MSG (hwndDlg, WM_INITDIALOG, helpDlg_OnInitDialog);
//// TODO: Add dialog message crackers here...
default:
return FALSE;
}
}
and WM_INITDIALOG handler...
//
// Process WM_INITDIALOG message for window/dialog: helpDlg
//
BOOL helpDlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
// fill the listbox
int itemdx;
// first clear all items if any
SendDlgItemMessage(hwnd, IDC_MESSAGES, LB_RESETCONTENT, 0, 0);
// add messages to listbox
for (int i = 0; i < numMessages; i++)
itemdx = (int)SendDlgItemMessage (hwnd, IDC_CBOMSG, LB_ADDSTRING, 0, (LPARAM)msginfo[i].WM_msg);
return FALSE;
}
and the function where it's called...
//
// process WM_ONCOMMAND
//
void Cls_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
HMENU hMenu;
BYTE bAlpha; // window transparency alpha
HMODULE hUser32;
PSLWA pSetLayeredWndAttr;
switch (id)
{
// menus
case ID_HELP_ABOUT:
DialogBox(GetModuleHandle(0), MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlg_DlgProc);
break;
case ID_HELP_MESSAGEHELP: // hereĦs where i call the dlg which does not appear!
DialogBox(GetModuleHandle(0), MAKEINTRESOURCE(IDD_HELPWINDOW), hwnd, helpDlg_DlgProc);
break;
...
some clues?
thanks.