Createdialog Error 1814
applications. I'm having a problem getting a dialog box to pop up on top of my main window ...the CreateDialog() method returns a NULL for some reason. Would really appreciate some help with this. Here is the source code -- http://www.apcx.3rror.com/main.cpp (the program runs, but the test condition for CreateDialog()'s return value shows a NULL value is returned) The resource file: Quote: #include "windows.h" IDD_TOOLBAR DIALOGEX 0, 0, 98, 52 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION EXSTYLE WS_EX_TOOLWINDOW CAPTION "My Dialog Toolbar" FONT 8, "MS Sans Serif" BEGIN PUSHBUTTON "&Press This Button",IDC_PRESS,7,7,84,14 PUSHBUTTON "&Or This One",IDC_OTHER,7,31,84,14 END Window Procedure of the main window... Quote: Code: LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch http://archicad-talk.graphisoft.com/viewtopic.php?p=98494 (message)
{
case WM_CREATE:
{
hDialog = CreateDialog(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_TOOLBAR),hwnd, ToolDlgProc);
if(hDialog != NULL)
{
ShowWindow(hDialog, SW_SHOW);
http://forums.codeguru.com/printthread.php?t=377230 }
else
{
MessageBox(hwnd, "CreateDialog returned NULL", "Warning!", MB_OK | MB_ICONINFORMATION);
}
}
break;
//handle other messages...
} ...where the (HWND) hDialog is declared as global variable. Message Handling function of the dialog box... Quote: Code: BOOL CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_PRESS:
MessageBox(hwnd, "Hi!", "This is a message", MB_OK | MB_ICONEXCLAMATION);
break;
case IDC_OTHER:
MessageBox(hwnd, "Bye!", "This is also a message", MB_OK | MB_ICONEXCLAMATION);
break;
}
break;
default:
return FALSE;
}
() mail ! gmail ! com [Download message RAW] On Fri, Nov 12, 2010 at 14:20, John Brown