Modeless Dialog fails to stay displayed.
Hello,
Does anybody have any idea why this snippet of code produces a modeless dialog box (when included in a subroutine contained in a DLL)that flashes on the screen for a fraction of a second and then disappears . When I call another subroutine (also in the DLL) that produces a modal dialog box, then both the modeless and modal dialog boxes are displayed in the window. I am able to manipulate the dialog boxes separately.
Code:
// Modeless Dialog
extern"C"
{
TS104_API INT TS104_S1(VOID)
{
int err;
hWnd = 0;
hInstance = GetModuleHandle(L"TS104.dll");
if( hInstance <= NULL)
{
MessageBox( NULL, L"CreateDialog handle is illegal", L"TS104_S1 Warning!",
MB_OK | MB_ICONINFORMATION );
return FALSE;
}
hWndParent = NULL;
hDlg = CreateDialog( hInstance, MAKEINTRESOURCE(IDD_DIALOG2), hWndParent, (DLGPROC)GoTo1Proc );
ShowWindow( hDlg, SW_SHOW );
return TRUE;
}
}
INT_PTR CALLBACK GoTo1Proc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
switch ( uMsg )
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch (LOWORD( wParam ))
{
case IDOK:
case IDCANCEL:
DestroyWindow( hDlg );
return TRUE;
}
}
Any suggestions would be appreciated!
Regards,
-Frank