/*============================================================== * 注册热键 *==============================================================*/ internal static void RegHotKey(IntPtr hwnd, int hotKeyId, e_KeyModifiers keyModifiers, Keys key) { if (!RegisterHotKey(hwnd, hotKeyId, keyModifiers, key)) { int errorCode = Marshal.GetLastWin32Error(); string err_txt = (errorCode == 1409) ? "热键被占用!" : $"注册热键失败!({errorCode})"; MessageBox.Show(err_txt); } }
/*============================================================== * 注册热键 *==============================================================*/ internal static void RegHotKey(IntPtr hwnd, int hotKeyId, e_KeyModifiers keyModifiers, Keys key) { if (!RegisterHotKey(hwnd, hotKeyId, keyModifiers, key)) { int errorCode = Marshal.GetLastWin32Error(); string err_txt = (errorCode == 1409) ? "热键被占用!" : $"注册热键失败!({errorCode})"; frm_Mainform.m_s_mainform.toolStripStatusLabel_ErrorMsg.Text = err_txt; frm_Mainform.m_s_mainform.toolStripStatusLabel_ErrorMsg.Visible = true; } }
public static extern bool RegisterHotKey(IntPtr hWnd, int id, e_KeyModifiers fsModifiers, Keys vk);