int UnsafeNativeMethods.IOleControlSite.TranslateAccelerator(ref System.Windows.Forms.NativeMethods.MSG pMsg, int grfModifiers) { int num; this.Host.SetAXHostState(WebBrowserHelper.siteProcessedInputKey, true); Message msg = new Message { Msg = pMsg.message, WParam = pMsg.wParam, LParam = pMsg.lParam, HWnd = pMsg.hwnd }; try { num = (this.Host.PreProcessControlMessage(ref msg) == PreProcessControlState.MessageProcessed) ? 0 : 1; } finally { this.Host.SetAXHostState(WebBrowserHelper.siteProcessedInputKey, false); } return(num); }
private void ForceSynchronousPaint() { if (!base.IsDisposed && (this._numPaintsServiced == 0)) { try { System.Windows.Forms.NativeMethods.MSG msg = new System.Windows.Forms.NativeMethods.MSG(); while (System.Windows.Forms.UnsafeNativeMethods.PeekMessage(ref msg, new HandleRef(this, IntPtr.Zero), 15, 15, 1)) { System.Windows.Forms.SafeNativeMethods.UpdateWindow(new HandleRef(null, msg.hwnd)); if (this._numPaintsServiced++ > 20) { return; } } } finally { this._numPaintsServiced = 0; } } }
bool UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(ref System.Windows.Forms.NativeMethods.MSG msg) { UnsafeNativeMethods.IMsoComponent component = this.Component; return((component != null) && component.FPreTranslateMessage(ref msg)); }
protected internal override bool ProcessMnemonic(char charCode) { if (base.CanSelect) { try { System.Windows.Forms.NativeMethods.tagCONTROLINFO pCI = new System.Windows.Forms.NativeMethods.tagCONTROLINFO(); if (System.Windows.Forms.NativeMethods.Failed(this.GetOleControl().GetControlInfo(pCI))) { return false; } System.Windows.Forms.NativeMethods.MSG lpMsg = new System.Windows.Forms.NativeMethods.MSG { hwnd = (this.ContainingControl == null) ? IntPtr.Zero : this.ContainingControl.Handle, message = 260, wParam = (IntPtr) char.ToUpper(charCode, CultureInfo.CurrentCulture), lParam = (IntPtr) 0x20180001, time = System.Windows.Forms.SafeNativeMethods.GetTickCount() }; System.Windows.Forms.NativeMethods.POINT pt = new System.Windows.Forms.NativeMethods.POINT(); System.Windows.Forms.UnsafeNativeMethods.GetCursorPos(pt); lpMsg.pt_x = pt.x; lpMsg.pt_y = pt.y; if (System.Windows.Forms.SafeNativeMethods.IsAccelerator(new HandleRef(pCI, pCI.hAccel), pCI.cAccel, ref lpMsg, null)) { this.GetOleControl().OnMnemonic(ref lpMsg); base.Focus(); return true; } } catch (Exception) { return false; } } return false; }
public override bool PreProcessMessage(ref Message msg) { if (this.IsUserMode()) { if (this.axState[siteProcessedInputKey]) { return base.PreProcessMessage(ref msg); } System.Windows.Forms.NativeMethods.MSG lpmsg = new System.Windows.Forms.NativeMethods.MSG { message = msg.Msg, wParam = msg.WParam, lParam = msg.LParam, hwnd = msg.HWnd }; this.axState[siteProcessedInputKey] = false; try { System.Windows.Forms.UnsafeNativeMethods.IOleInPlaceActiveObject inPlaceActiveObject = this.GetInPlaceActiveObject(); if (inPlaceActiveObject != null) { int num = inPlaceActiveObject.TranslateAccelerator(ref lpmsg); msg.Msg = lpmsg.message; msg.WParam = lpmsg.wParam; msg.LParam = lpmsg.lParam; msg.HWnd = lpmsg.hwnd; switch (num) { case 0: return true; case 1: { bool flag = false; this.ignoreDialogKeys = true; try { flag = base.PreProcessMessage(ref msg); } finally { this.ignoreDialogKeys = false; } return flag; } } return (this.axState[siteProcessedInputKey] && base.PreProcessMessage(ref msg)); } } finally { this.axState[siteProcessedInputKey] = false; } } return false; }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (base.ProcessCmdKey(ref msg, keyData)) { return true; } MainMenu menu = (MainMenu) base.Properties.GetObject(PropCurMenu); if ((menu != null) && menu.ProcessCmdKey(ref msg, keyData)) { return true; } bool flag = false; System.Windows.Forms.NativeMethods.MSG msg2 = new System.Windows.Forms.NativeMethods.MSG { message = msg.Msg, wParam = msg.WParam, lParam = msg.LParam, hwnd = msg.HWnd }; if (((this.ctlClient != null) && (this.ctlClient.Handle != IntPtr.Zero)) && System.Windows.Forms.UnsafeNativeMethods.TranslateMDISysAccel(this.ctlClient.Handle, ref msg2)) { flag = true; } msg.Msg = msg2.message; msg.WParam = msg2.wParam; msg.LParam = msg2.lParam; msg.HWnd = msg2.hwnd; return flag; }
private void WmTabBaseReLayout(ref Message m) { this.BeginUpdate(); this.cachedDisplayRect = Rectangle.Empty; this.UpdateTabSelection(false); this.EndUpdate(); base.Invalidate(true); System.Windows.Forms.NativeMethods.MSG msg = new System.Windows.Forms.NativeMethods.MSG(); IntPtr handle = base.Handle; while (System.Windows.Forms.UnsafeNativeMethods.PeekMessage(ref msg, new HandleRef(this, handle), this.tabBaseReLayoutMessage, this.tabBaseReLayoutMessage, 1)) { } }
public static extern bool IsAccelerator(HandleRef hAccel, int cAccelEntries, [In] ref System.Windows.Forms.NativeMethods.MSG lpMsg, short[] lpwCmd);
int UnsafeNativeMethods.IOleInPlaceFrame.TranslateAccelerator(ref System.Windows.Forms.NativeMethods.MSG lpmsg, short wID) { return(1); }
private void ShowInvalidMessage(string propName, object value, Exception ex) { if (value == null) { value = "(null)"; } if (propName == null) { propName = "(unknown)"; } bool hookMouseDown = this.Edit.HookMouseDown; this.Edit.DisableMouseHook = true; this.SetCommitError(2, false); System.Windows.Forms.NativeMethods.MSG msg = new System.Windows.Forms.NativeMethods.MSG(); while (System.Windows.Forms.UnsafeNativeMethods.PeekMessage(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0x200, 0x20a, 1)) { } if (ex is TargetInvocationException) { ex = ex.InnerException; } string message = ex.Message; bool flag2 = false; while ((message == null) || (message.Length == 0)) { ex = ex.InnerException; if (ex == null) { break; } message = ex.Message; } IUIService service = (IUIService) this.GetService(typeof(IUIService)); this.ErrorDialog.Message = System.Windows.Forms.SR.GetString("PBRSErrorInvalidPropertyValue"); this.ErrorDialog.Text = System.Windows.Forms.SR.GetString("PBRSErrorTitle"); this.ErrorDialog.Details = message; if (service != null) { flag2 = DialogResult.Cancel == service.ShowDialog(this.ErrorDialog); } else { flag2 = DialogResult.Cancel == this.ShowDialog(this.ErrorDialog); } this.Edit.DisableMouseHook = false; if (hookMouseDown) { this.SelectGridEntry(this.selectedGridEntry, true); } this.SetCommitError(1, hookMouseDown); if (flag2) { this.OnEscape(this.Edit); } }
int System.Windows.Forms.UnsafeNativeMethods.IDocHostUIHandler.TranslateAccelerator(ref System.Windows.Forms.NativeMethods.MSG msg, ref Guid group, int nCmdID) { WebBrowser host = (WebBrowser)base.Host; if (!host.WebBrowserShortcutsEnabled) { int num = ((int)msg.wParam) | Control.ModifierKeys; if ((msg.message != 0x102) && System.Enum.IsDefined(typeof(Shortcut), (Shortcut)num)) { return(0); } } return(1); }
private void ForceSynchronousPaint() { if (!base.IsDisposed && (this._numPaintsServiced == 0)) { try { System.Windows.Forms.NativeMethods.MSG msg = new System.Windows.Forms.NativeMethods.MSG(); while (System.Windows.Forms.UnsafeNativeMethods.PeekMessage(ref msg, new HandleRef(this, IntPtr.Zero), 15, 15, 1)) { System.Windows.Forms.SafeNativeMethods.UpdateWindow(new HandleRef(null, msg.hwnd)); if (this._numPaintsServiced++ > 20) { return; } } } finally { this._numPaintsServiced = 0; } } }
public static bool FilterMessage(ref Message message) { bool flag; System.Windows.Forms.NativeMethods.MSG msg = new System.Windows.Forms.NativeMethods.MSG { hwnd = message.HWnd, message = message.Msg, wParam = message.WParam, lParam = message.LParam }; bool flag2 = ThreadContext.FromCurrent().ProcessFilters(ref msg, out flag); if (flag) { message.HWnd = msg.hwnd; message.Msg = msg.message; message.WParam = msg.wParam; message.LParam = msg.lParam; } return flag2; }
private bool LocalModalMessageLoop(Form form) { try { System.Windows.Forms.NativeMethods.MSG msg = new System.Windows.Forms.NativeMethods.MSG(); bool flag = false; bool flag2 = true; while (flag2) { if (!System.Windows.Forms.UnsafeNativeMethods.PeekMessage(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0, 0)) { goto Label_00AB; } if ((msg.hwnd != IntPtr.Zero) && System.Windows.Forms.SafeNativeMethods.IsWindowUnicode(new HandleRef(null, msg.hwnd))) { flag = true; if (System.Windows.Forms.UnsafeNativeMethods.GetMessageW(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0)) { goto Label_0074; } continue; } flag = false; if (!System.Windows.Forms.UnsafeNativeMethods.GetMessageA(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0)) { continue; } Label_0074: if (!this.PreTranslateMessage(ref msg)) { System.Windows.Forms.UnsafeNativeMethods.TranslateMessage(ref msg); if (flag) { System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(ref msg); } else { System.Windows.Forms.UnsafeNativeMethods.DispatchMessageA(ref msg); } } if (form != null) { flag2 = !form.CheckCloseDialog(false); } continue; Label_00AB: if (form == null) { break; } if (!System.Windows.Forms.UnsafeNativeMethods.PeekMessage(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0, 0)) { System.Windows.Forms.UnsafeNativeMethods.WaitMessage(); } } return flag2; } catch { return false; } }
bool System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, int reason, int pvLoopData) { int key = (int) ((long) dwComponentID); int currentState = this.currentState; bool flag = true; if (!this.OleComponents.ContainsKey(key)) { return false; } System.Windows.Forms.UnsafeNativeMethods.IMsoComponent activeComponent = this.activeComponent; try { System.Windows.Forms.NativeMethods.MSG msg = new System.Windows.Forms.NativeMethods.MSG(); System.Windows.Forms.NativeMethods.MSG[] pMsgPeeked = new System.Windows.Forms.NativeMethods.MSG[] { msg }; bool flag2 = false; ComponentHashtableEntry entry = (ComponentHashtableEntry) this.OleComponents[key]; if (entry == null) { return false; } System.Windows.Forms.UnsafeNativeMethods.IMsoComponent component = entry.component; this.activeComponent = component; while (flag) { System.Windows.Forms.UnsafeNativeMethods.IMsoComponent trackingComponent; if (this.trackingComponent != null) { trackingComponent = this.trackingComponent; } else if (this.activeComponent != null) { trackingComponent = this.activeComponent; } else { trackingComponent = component; } if (System.Windows.Forms.UnsafeNativeMethods.PeekMessage(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0, 0)) { pMsgPeeked[0] = msg; flag = trackingComponent.FContinueMessageLoop(reason, pvLoopData, pMsgPeeked); if (flag) { if ((msg.hwnd != IntPtr.Zero) && System.Windows.Forms.SafeNativeMethods.IsWindowUnicode(new HandleRef(null, msg.hwnd))) { flag2 = true; System.Windows.Forms.UnsafeNativeMethods.GetMessageW(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0); } else { flag2 = false; System.Windows.Forms.UnsafeNativeMethods.GetMessageA(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0); } if (msg.message == 0x12) { Application.ThreadContext.FromCurrent().DisposeThreadWindows(); if (reason != -1) { System.Windows.Forms.UnsafeNativeMethods.PostQuitMessage((int) msg.wParam); } flag = false; goto Label_024C; } if (!trackingComponent.FPreTranslateMessage(ref msg)) { System.Windows.Forms.UnsafeNativeMethods.TranslateMessage(ref msg); if (flag2) { System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(ref msg); } else { System.Windows.Forms.UnsafeNativeMethods.DispatchMessageA(ref msg); } } } } else { if ((reason == 2) || (reason == -2)) { goto Label_024C; } bool flag4 = false; if (this.OleComponents != null) { IEnumerator enumerator = this.OleComponents.Values.GetEnumerator(); while (enumerator.MoveNext()) { ComponentHashtableEntry current = (ComponentHashtableEntry) enumerator.Current; flag4 |= current.component.FDoIdle(-1); } } flag = trackingComponent.FContinueMessageLoop(reason, pvLoopData, null); if (flag) { if (flag4) { System.Windows.Forms.UnsafeNativeMethods.MsgWaitForMultipleObjectsEx(0, IntPtr.Zero, 100, 0xff, 4); } else if (!System.Windows.Forms.UnsafeNativeMethods.PeekMessage(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0, 0)) { System.Windows.Forms.UnsafeNativeMethods.WaitMessage(); } } } } } finally { this.currentState = currentState; this.activeComponent = activeComponent; } Label_024C: return !flag; }
bool System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FContinueIdle() { System.Windows.Forms.NativeMethods.MSG msg = new System.Windows.Forms.NativeMethods.MSG(); return !System.Windows.Forms.UnsafeNativeMethods.PeekMessage(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0, 0); }