Skip to main content
gamedev.net
🔒 Locked

CreateDialog C++ problem

Started by Knowone 1 reply 500+ views
Original Post
Knowone
Knowone
I''m having troble with this code. g_hWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_Mouse), 0, NULL); if(g_hWnd == NULL) MessageBox(g_hWnd, "NULL" , "Error", MB_OK); UpdateWindow(g_hWnd); ShowWindow(g_hWnd, nCmdShow); I beleave it''s returning a Null to g_hWnd, and not the instance like it should. I don''t get any errors, the program runs but it doesn''t make a dialog window.
Maega
Maega
You need a message pump and a dialog procedure (the NULL part of your CreateDialog call)

Ethereal [unused]
Ethereal [unused]
You need something along these lines:

      
// Define Prototype

BOOL CALLBACK fnDlgMessageProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );

// Non blocking call to generate Dialog Box

g_hWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_Mouse), 0, (DLGPROC)fnDlgMessageProc);

// Dialog Processor

BOOL CALLBACK fnDlgMessageProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{

switch(uMsg)
{
case WM_CLOSE:
case WM_DESTROY:
PostQuitMessage(0);
EndDialog( hDlg, TRUE );
break;
}

return FALSE;
}


[edited by - Ethereal on May 18, 2003 7:10:20 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.