/// <summary> /// </summary> public bool TranslateAccelarator(Interop.COMMSG msg) { if (activeObject != null) { int hr = activeObject.TranslateAccelerator(msg); if (hr != Interop.S_FALSE) { return(true); } } return(false); }
internal bool PreTranslateMessage(Message msg) { Interop.COMMSG lpmsg = new Interop.COMMSG(); lpmsg.hwnd = msg.HWnd; lpmsg.lParam = msg.LParam; lpmsg.wParam = msg.WParam; lpmsg.message = msg.Msg; if (this.activeObject != null && this.activeObject.TranslateAccelerator(lpmsg) == Interop.S_OK) { return(true); } else { return(false); } }
/// <summary> /// We need to process keystrokes in order to pass them to MSHTML /// </summary> public override bool PreProcessMessage(ref Message m) { bool handled = false; if ((m.Msg >= Interop.WM_KEYFIRST) && (m.Msg <= Interop.WM_KEYLAST)) { // If it's a key down, first see if the key combo is a command key if (m.Msg == Interop.WM_KEYDOWN) { handled = ProcessCmdKey(ref m, (Keys)(int)m.WParam | ModifierKeys); } if (!handled) { int keyCode = (int)m.WParam; // Don't let Trident eat Ctrl-PgUp/PgDn if (((keyCode != (int)Keys.PageUp) && (keyCode != (int)Keys.PageDown)) || ((ModifierKeys & Keys.Control) == 0)) { Interop.COMMSG cm = new Interop.COMMSG(); cm.hwnd = m.HWnd; cm.message = m.Msg; cm.wParam = m.WParam; cm.lParam = m.LParam; handled = _site.TranslateAccelarator(cm); } else { // WndProc for Ctrl-PgUp/PgDn is never called so call it directly here WndProc(ref m); handled = true; } } } if (!handled) { handled = base.PreProcessMessage(ref m); } return(handled); }
/// <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); }
public int TranslateAccelerator(Interop.COMMSG msg, ref Guid group, int nCmdID) { return(Interop.S_FALSE); }
public int TranslateAccelerator(Interop.COMMSG lpmsg, short wID) { return(Interop.S_FALSE); }