project64/Source/Project64/UserInterface/SupportEnterCode.cpp

61 lines
2.2 KiB
C++
Raw Normal View History

2016-08-11 10:38:45 +00:00
#include "stdafx.h"
#include "SupportEnterCode.h"
#include <Project64-core/Settings/SettingType/SettingsType-Application.h>
#include "resource.h"
LRESULT CSupportEnterCode::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
2020-05-12 12:19:05 +00:00
::SetWindowTextW(m_hWnd, wGS(MSG_SUPPORT_ENTER_CODE_TITLE).c_str());
::SetWindowTextW(GetDlgItem(IDOK), wGS(MSG_SUPPORT_OK).c_str());
::SetWindowTextW(GetDlgItem(IDCANCEL), wGS(MSG_SUPPORT_CANCEL).c_str());
::SetWindowTextW(GetDlgItem(IDC_DESCRIPTION), wGS(MSG_SUPPORT_ENTER_CODE_DESC).c_str());
2016-08-11 10:38:45 +00:00
return TRUE;
}
LRESULT CSupportEnterCode::OnColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
HDC hdcStatic = (HDC)wParam;
SetTextColor(hdcStatic, RGB(0, 0, 0));
SetBkMode(hdcStatic, TRANSPARENT);
return (LONG)(LRESULT)((HBRUSH)GetStockObject(NULL_BRUSH));
}
LRESULT CSupportEnterCode::OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
static HPEN outline = CreatePen(PS_SOLID, 1, 0x00FFFFFF);
static HBRUSH fill = CreateSolidBrush(0x00FFFFFF);
SelectObject((HDC)wParam, outline);
SelectObject((HDC)wParam, fill);
RECT rect;
GetClientRect(&rect);
Rectangle((HDC)wParam, rect.left, rect.top, rect.right, rect.bottom);
return TRUE;
}
LRESULT CSupportEnterCode::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return TRUE;
}
LRESULT CSupportEnterCode::OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
2020-05-12 12:19:05 +00:00
wchar_t code[50];
if (!GetDlgItemText(IDC_CODE,code,sizeof(code) /sizeof(code[0])))
2016-08-11 10:38:45 +00:00
{
2020-05-12 12:19:05 +00:00
MessageBox(wGS(MSG_SUPPORT_ENTER_SUPPORT_CODE).c_str(), wGS(MSG_SUPPORT_PROJECT64).c_str(), MB_OK);
2016-08-11 10:38:45 +00:00
return false;
}
2020-05-12 12:19:05 +00:00
if (_wcsicmp(code,L"thank you from project64") != 0)
2016-08-11 10:38:45 +00:00
{
2020-05-12 12:19:05 +00:00
MessageBox(wGS(MSG_SUPPORT_INCORRECT_CODE).c_str(), wGS(MSG_SUPPORT_PROJECT64).c_str(), MB_OK);
2016-08-11 10:38:45 +00:00
return false;
}
UISettingsSaveDword(SupportWindows_RunCount, (uint32_t) -1);
CSettingTypeApplication::Flush();
2020-05-12 12:19:05 +00:00
MessageBox(wGS(MSG_SUPPORT_COMPLETE).c_str(), wGS(MSG_SUPPORT_PROJECT64).c_str(), MB_OK);
2016-08-11 10:38:45 +00:00
EndDialog(wID);
return TRUE;
}