Show timeout in support window

This commit is contained in:
zilmar 2020-05-11 16:42:58 +09:30
parent ce233b00d8
commit 0429c207e6
2 changed files with 13 additions and 4 deletions

View File

@ -5,6 +5,7 @@
HWND CSupportWindow::m_hParent = NULL;
CSupportWindow * CSupportWindow::m_this = NULL;
uint32_t CSupportWindow::m_RunCount = 0;
uint32_t CSupportWindow::m_TimeOutTime = 30;
CSupportWindow::CSupportWindow(void)
{
@ -91,7 +92,7 @@ LRESULT CSupportWindow::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
::EnableWindow(GetDlgItem(IDCANCEL), false);
srand ((uint32_t)time(NULL));
SetTimer(0, ((rand() % 35) + 5) * 1000, NULL);
SetTimer(0, 1000, NULL);
}
return TRUE;
}
@ -120,8 +121,14 @@ LRESULT CSupportWindow::OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /
LRESULT CSupportWindow::OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
KillTimer(wParam);
EnableContinue();
m_TimeOutTime -= 1;
if (m_TimeOutTime == 0)
{
KillTimer(wParam);
EnableContinue();
}
stdstr_f continue_txt(m_TimeOutTime > 0 ? "%s (%d)" : "%s", GS(MSG_SUPPORT_CONTINUE), m_TimeOutTime);
SetWindowTextW(GetDlgItem(IDCANCEL), continue_txt.ToUTF16().c_str());
return true;
}
@ -133,7 +140,8 @@ LRESULT CSupportWindow::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCt
LRESULT CSupportWindow::OnSupportProject64(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
ShellExecute(NULL, "open", "http://www.pj64-emu.com/support-project64.html", NULL, NULL, SW_SHOWMAXIMIZED);
std::string SupportURL = stdstr_f("http://www.pj64-emu.com/support-project64.html?ver=%s", VER_FILE_VERSION_STR);
ShellExecute(NULL, "open", SupportURL.c_str(), NULL, NULL, SW_SHOWMAXIMIZED);
return TRUE;
}

View File

@ -40,4 +40,5 @@ private:
static HWND m_hParent;
static CSupportWindow * m_this;
static uint32_t m_RunCount;
static uint32_t m_TimeOutTime;
};