int MessageBox::Ask(MessageBox_Questions question) { std::wstring msg; std::wstring title; int buttonFlags; int defaultAnswer = IDOK; switch(question) { case QUESTION_WHERES_THE_CD: { msg = g_pApp->GetString(_T("IDS_QUESTION_WHERES_THE_CD")); title = g_pApp->GetString(_T("IDS_ALERT")); buttonFlags = MB_RETRYCANCEL|MB_ICONEXCLAMATION; defaultAnswer = IDCANCEL; break; } case QUESTION_QUIT_GAME: { msg = g_pApp->GetString(_T("IDS_QUESTION_QUIT_GAME")); title = g_pApp->GetString(_T("IDS_QUESTION")); buttonFlags = MB_YESNO|MB_ICONQUESTION; defaultAnswer = IDNO; break; } default: GCC_ASSERT(0 && _T("Undefined question in Game::Ask")); return IDCANCEL; } if (g_pApp && g_pApp->IsRunning()) { ShowCursor(true); shared_ptr<MessageBox> pMessageBox(new MessageBox(msg, title, buttonFlags)); int result = g_pApp->Modal(pMessageBox, defaultAnswer); ShowCursor(false); return result; } return ::MessageBox(g_pApp ? g_pApp->GetHwnd() : NULL, msg.c_str(), title.c_str(), buttonFlags); }
int WINAPI MyMessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType) { int ret = pMessageBox(hWnd, TEXT("injection success\n"), lpCaption, uType); return ret; }