From a1dd103887ff7e6b6881716da495b4e57ed754c0 Mon Sep 17 00:00:00 2001 From: RadAd Date: Mon, 15 Jul 2019 16:39:00 +1000 Subject: Use registry setting for MDI mode --- RadTerminal.cpp | 2 +- WinUtils.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/RadTerminal.cpp b/RadTerminal.cpp index 87d352f..be590a9 100644 --- a/RadTerminal.cpp +++ b/RadTerminal.cpp @@ -182,7 +182,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, PTSTR pCmdLine, int nCmdSho HWND hWnd = NULL; HWND hWndMDIClient = NULL; HACCEL hAccel = NULL; - bool bMDI = true; + bool bMDI = RegGetDWORD(HKEY_CURRENT_USER, _T("Software\\RadSoft\\" PROJ_CODE), _T("MDI"), TRUE) > 0; CHECK(GetRadTerminalAtom(hInstance), EXIT_FAILURE); diff --git a/WinUtils.h b/WinUtils.h index 4f544a1..ffd3929 100644 --- a/WinUtils.h +++ b/WinUtils.h @@ -128,6 +128,16 @@ inline DWORD RegGetDWORD(HKEY hKey, LPCTSTR sValue, DWORD dwDef) return dwDef; } +inline DWORD RegGetDWORD(HKEY hKey, LPCTSTR sSubKey, LPCTSTR sValue, DWORD dwDef) +{ + DWORD data = 0; + DWORD len = sizeof(data); + if (RegGetValue(hKey, sSubKey, sValue, RRF_RT_REG_DWORD, nullptr, &data, &len) == ERROR_SUCCESS) + return data; + else + return dwDef; +} + inline HWND GetMDIClient(HWND hWnd) { return FindWindowEx(hWnd, NULL, TEXT("MDICLIENT"), nullptr); -- cgit v1.2.3