SDK方式下的退出窗口提示

阅读更多

退出窗口前询问“是否要退出当前窗口”

BOOL Cls_OnQueryEndSession (HWND hwnd) { BOOL fOKToEndSession = TRUE; if (g_fIsDataUnsaved) { int n = MessageBox(hwnd, "Do you want to save changes?", "Application caption", MB_YESNOCANCEL│MB_ICONWARING); if (n == IDYES) { } if (n == IDCANCEL) fOKToEndSession = FALSE; } return(fOKToEndSession); } void Cls_OnEndSession (HWND hwnd, BOOL fEnding) { if (fEnding) { DestroyWindow(hwnd); } } void Cls_OnDestroy (HWND hwnd) { PostQuitMessage(0); } void Cls_OnClose (HWND hwnd) { BOOL fOKToClose = Cls_OnQueryEndSession(hwnd); Cls_OnEndSession(hwnd, fOKToClose); }


你可能感兴趣的:(SDK方式下的退出窗口提示)