BOOL CALLBACK DlgProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch( uMsg )
{
case WM_INITDIALOG:
InitDlgBox(hwndDlg); // initialize some variables
return true;
break;
case WM_CLOSE:
DestroyWindow(hwndDlg);
PostQuitMessage(0);
return true;
break;
case WM_COMMAND:
if(LOWORD(wParam==IDC_ABBRECHEN)) { // cancel button pressed ?
DestroyWindow(hwndDlg);
PostQuitMessage(0);
status=false; // Dialog is canceled
return true;
}
if(LOWORD(wParam==IDC_START)) { // start button pressed ?
SaveOptions(hwndDlg);
DestroyWindow(hwndDlg);
PostQuitMessage(0);
status=true; // Dialog is accepted
return true;
}
break;
}
return false;
}
bool DlgBox(HINSTANCE hInstance)
{
HWND hwndDlg;
hwndDlg=CreateDialog(hInstance,MAKEINTRESOURCE(IDD_DLG),NULL,
(DLGPROC)DlgProc) ;
ShowWindow(hwndDlg, SW_NORMAL);
UpdateWindow(hwndDlg);
while( GetMessage( &DlgMsg, NULL, 0, 0) )
{
TranslateMessage(&DlgMsg);
DispatchMessage(&DlgMsg);
}
return status; // should return true if Dlg is accepted otherwise false
}
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
.....
.....
if(DlgBox(hInstance)==false) {
return false; // <= seems to cause the problem (should exit
WinMain)
}
.....
.....
.....
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment