My issue is that I am trying to create a Opengl/Win32 application and I am unable to keep my dialog box open. It literally flashes as if someone pressed cancel on it RIGHT when it opened. I've looked around google and found a few others with this issue, but none of the solutions they posted have helped me, so I turn to the StackOverflow community!
Initially, I wrote code for the Dialog Procedure...
LRESULT CALLBACK LoginDlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
ShowWindow(hWndDlg, SW_SHOW); // These were added to get the window to show up
UpdateWindow(hWndDlg); // even if the chance was small.
switch(Msg)
{
case WM_INITDIALOG:
return true;
case WM_COMMAND:
switch(wParam)
{
case IDOK:
EndDialog(hWndDlg, 0);
return TRUE;
}
break;
}
return FALSE;
}
I then wrote the actual code to display the box.
void DisplayLoginBox()
{
LoginDlgHwnd = NULL;
LoginDlgHwnd = (HWND)DialogBox(GetModuleHandle(NULL),
MAKEINTRESOURCE(LOGIN_DIALOG),
app.GetHandle(),
reinterpret_cast<DLGPROC>(LoginDlgProc)
);
if(LoginDlgHwnd == NULL)
MessageBox(NULL, NULL, NULL, MB_OK);
}
app.GetHandle() returns a hwnd of the main program. This function works properly. and LoginDlgHwnd is a global variable.
The actual dialog is created and included properly as well. Do you have any ideas? -Celestialkey