void CPrefKeyBindingsPage::FillInControls() { for (int i = m_firstItem; i < m_lastItem; i++) { bool assignKey = g_config.m_keys[i].m_assignKey; ((CButton*)GetDlgItem(IDC_PKB_KEYCHECK1 + i - 1))->SetCheck(assignKey); CHotKeyCtrl* hkCtrl = (CHotKeyCtrl*)GetDlgItem(IDC_PKB_KEY1 + i - 1); hkCtrl->EnableWindow(assignKey); WORD vk; WORD mod; TranslateDSToHK(g_config.m_keys[i].m_keyStr, vk, mod); hkCtrl->SetHotKey(vk, mod); } }
void CHotKey::CopyToCtrl(CHotKeyCtrl& ctrl, HWND hParent, int nWindowsCBID) { long lModifiers = HIBYTE(m_Key); long keys = LOBYTE(m_Key); ctrl.SetHotKey(keys, (WORD)lModifiers & ~HOTKEYF_EXT); if(lModifiers & HOTKEYF_EXT) { ::CheckDlgButton(hParent, nWindowsCBID, BST_CHECKED); } }
void CHotKey::CopyFromCtrl(CHotKeyCtrl& ctrl, HWND hParent, int nWindowsCBID) { long lHotKey = ctrl.GetHotKey(); short sKeyKode = LOBYTE(lHotKey); short sModifers = HIBYTE(lHotKey); if(lHotKey && ::IsDlgButtonChecked(hParent, nWindowsCBID)) { sModifers |= HOTKEYF_EXT; } SetKey(MAKEWORD(sKeyKode, sModifers)); }