Add escape hotkey to main dialog

This commit is contained in:
Grayson Riffe 2023-09-05 15:32:54 -05:00
parent 7821233a52
commit 3599be9c61

View File

@ -29,7 +29,7 @@ namespace wc {
: m_appName(appName.begin(), appName.end()) : m_appName(appName.begin(), appName.end())
, m_appVersion(appVersion.begin(), appVersion.end()) , m_appVersion(appVersion.begin(), appVersion.end())
{ {
std::wcout << std::format(L"{} {}", m_appName, m_appVersion); std::wcout << std::format(L"{} {}\n", m_appName, m_appVersion);
} }
void Application::run() { void Application::run() {
@ -85,6 +85,9 @@ namespace wc {
SendDlgItemMessage(dlg, IDC_EDITADDRESS, EM_SETCUEBANNER, TRUE, reinterpret_cast<LPARAM>(L"Address")); SendDlgItemMessage(dlg, IDC_EDITADDRESS, EM_SETCUEBANNER, TRUE, reinterpret_cast<LPARAM>(L"Address"));
SendDlgItemMessage(dlg, IDC_EDITSCREENNAME, EM_SETCUEBANNER, TRUE, reinterpret_cast<LPARAM>(L"User")); SendDlgItemMessage(dlg, IDC_EDITSCREENNAME, EM_SETCUEBANNER, TRUE, reinterpret_cast<LPARAM>(L"User"));
RegisterHotKey(dlg, 1, MOD_NOREPEAT, VK_ESCAPE);
return TRUE; return TRUE;
} }
@ -118,6 +121,10 @@ namespace wc {
return FALSE; return FALSE;
case WM_HOTKEY:
if (wParam != 1)
return FALSE;
[[fallthrough]];
case WM_CLOSE: case WM_CLOSE:
EndDialog(dlg, 0); EndDialog(dlg, 0);
return TRUE; return TRUE;