From fa32e0c6d33792861fa4a7fac83f5bf987d1ac3d Mon Sep 17 00:00:00 2001 From: RadAd Date: Tue, 6 Jul 2021 16:37:01 +1000 Subject: Update to latest VS2019 --- RadTerminalFrame.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'RadTerminalFrame.cpp') diff --git a/RadTerminalFrame.cpp b/RadTerminalFrame.cpp index 58a7563..eed6274 100644 --- a/RadTerminalFrame.cpp +++ b/RadTerminalFrame.cpp @@ -70,9 +70,8 @@ BOOL RadTerminalFrameOnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct) if (RegOpenKey(HKEY_CURRENT_USER, REG_BASE TEXT("\\Profiles"), &hMainKey) == ERROR_SUCCESS) { const std::tstring strDefault = RegGetString(HKEY_CURRENT_USER, REG_BASE, TEXT("Profile"), TEXT("Cmd")); - DWORD i = 0; std::tstring strName; - for (int i = 0; RegEnumKeyEx(hMainKey, i, strName); ++i) + for (DWORD i = 0; RegEnumKeyEx(hMainKey, i, strName); ++i) { data->profiles.push_back(strName); if (strName != TEXT("Default")) @@ -91,6 +90,22 @@ BOOL RadTerminalFrameOnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct) DeleteMenu(hMenu, ID_NEW_PLACEHOLDER, MF_BYCOMMAND); RegCloseKey(hMainKey); } + + if (data->profiles.empty()) + { + std::tstring strName = TEXT("Cmd"); + + data->profiles.push_back(strName); + MENUITEMINFO mii = {}; + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE; + mii.fType = MFT_STRING; + mii.fState |= MFS_DEFAULT; + mii.wID = ID_NEW_PROFILE_1; + mii.dwTypeData = (LPTSTR) strName.c_str(); + InsertMenuItem(hMenu, ID_NEW_PLACEHOLDER, FALSE, &mii); + DeleteMenu(hMenu, ID_NEW_PLACEHOLDER, MF_BYCOMMAND); + } } HWND hWndMDIClient = CreateWindow(TEXT("MDICLIENT"), (LPCTSTR) NULL, -- cgit v1.2.3