CStringW CConfigShortcuts::AssembleKeyString(int Mod, int Key) { CAccelerator *pAccel = theApp.GetAccelerator(); CStringW KeyStr; if (Mod & MOD_SHIFT) { KeyStr.Append(pAccel->GetVKeyName(VK_SHIFT)); KeyStr.Append(L" + "); } if (Mod & MOD_CONTROL) { KeyStr.Append(pAccel->GetVKeyName(VK_CONTROL)); KeyStr.Append(L" + "); } if (Mod & MOD_ALT) { KeyStr.Append(pAccel->GetVKeyName(VK_MENU)); KeyStr.Append(L" + "); } KeyStr.Append(pAccel->GetVKeyName(Key)); return KeyStr; }
void CConfigShortcuts::StoreKey(int Item, int Key, int Mod) { // Store in temp. list CAccelerator *pAccel = theApp.GetAccelerator(); CStringW KeyName = pAccel->GetVKeyName(Key); // Save to list CListCtrl *pListView = static_cast<CListCtrl*>(GetDlgItem(IDC_SHORTCUTS)); pListView->SetItemText(m_iSelectedItem, 1, CAccelerator::MOD_NAMES[Mod]); pListView->SetItemText(m_iSelectedItem, 2, KeyName); m_iKeys[Item] = Key; m_iMods[Item] = Mod; }