From: voidnull on
Hello all,

I desire to create a modeless dialog with a custom class. The dialog
is created as a form. The code below shows what I'm doing. Yet
CreateDialog always returns NULL. I guess I don't know what I'm doing
wrong...

IDRESULTS DIALOGEX 0, 0, 412, 232
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX |
WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
CAPTION "Results"
CLASS "MyClass"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN

END

HWND RegisterResultsDlg(HINSTANCE hInst, HWND hwnd)
{
HWND hwndDlg;
WNDCLASS wc;

GetClassInfo(hInst,"#32770",&wc);
wc.lpfnWndProc = DlgResultsProc;
wc.lpszClassName = "MyClass";
if(!RegisterClass(&wc))
{
MessageBox(NULL, "Failed to Register Custom Dialog Class!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return NULL;
}

hwndDlg = (HWND)CreateDialog(hInst, "MyClass",
hwnd, DlgResultsProc);

if(hwndDlg == NULL)
{
MessageBox(NULL, "Failed to Create Results Dialog Box!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return NULL;
}
ShowWindow(hwndDlg,SW_SHOW);
return hwndDlg;
}
From: Christian ASTOR on
On 3 fév, 04:48, voidnull <grego...(a)gmail.com> wrote:

> hwndDlg = (HWND)CreateDialog(hInst, "MyClass",

The 2nd parameter must be the template name...