/// <summary> /// /// </summary> /// <param name="msg"></param> /// <param name="group"></param> /// <param name="nCmdID"></param> /// <returns></returns> /// <remarks> /// Main Accelerator Keys Supported by MsHtml /// Accelerator | Description /// Ctrl-N | Opens the current HTML document in a new WebBrowser window. /// Crtl-P | Displays a Print dialog box for printing the HTML document. /// Ctrl-A | Selects the entire contents of the HTML document. /// Crtl-F | Displays a Find dialog box for searching the HTML document. /// F5, Ctrl-F5 | Refreshes the currently loaded HTML document. /// </remarks> public int TranslateAccelerator(Interop.COMMSG msg, ref Guid group, int nCmdID) { const int WM_KEYDOWN = 0x0100; const int VK_CONTROL = 0x11; if (msg == null) { throw new ArgumentNullException("msg"); } if (msg.message != WM_KEYDOWN) { return(Interop.S_FALSE); // no keydown, allow message } Keys keyData = Keys.None; if (Interop.GetAsyncKeyState(VK_CONTROL) < 0) { keyData |= Keys.Control; // Ctrl key pressed } int key = msg.wParam.ToInt32(); key &= 0xFF; // get the virtual keycode keyData |= (Keys)key; KeyEventArgs kea = new KeyEventArgs(keyData); hostControl.RaiseOnTranslateAccelerator(kea); if (kea.Handled) { return(Interop.S_OK); } // not handled, allow everything else return(Interop.S_FALSE); }