private void form_reboot_FormClosed(object sender, FormClosedEventArgs e) { SystemHotKey.UnRegHotKey(Handle, 100); SystemHotKey.UnRegHotKey(Handle, 101); // 关闭浏览器窗口 ControlProcess.CloseProcess(); }
private void form_reboot_Load(object sender, EventArgs e) { //注册热键Shift+S,Id号为100。HotKey.KeyModifiers.Shift也可以直接使用数字4来表示。 SystemHotKey.RegHotKey(Handle, 100, SystemHotKey.KeyModifiers.Ctrl, Keys.F12); SystemHotKey.RegHotKey(Handle, 101, SystemHotKey.KeyModifiers.Ctrl, Keys.F11); Task.Factory.StartNew(() => { while (IsRunning) { ControlProcess.GetProcess(); } }); }