public FocusManagerImpl(DockPanel dockPanel) { m_dockPanel = dockPanel; m_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET); m_hookEventHandler = new LocalWindowsHook.HookEventHandler(HookEventHandler); m_localWindowsHook.HookInvoked += m_hookEventHandler; m_localWindowsHook.Install(); }
// Use a static instance of the windows hook to prevent stack overflows in the windows kernel. static FocusManagerImpl() { if (Win32Helper.IsRunningOnMono) { return; } sm_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET); sm_localWindowsHook.Install(); }
public FocusManagerImpl(DockPanel dockPanel) { m_dockPanel = dockPanel; if (!NativeMethods.ShouldUseWin32()) { return; } m_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET); m_hookEventHandler = new LocalWindowsHook.HookEventHandler(HookEventHandler); m_localWindowsHook.HookInvoked += m_hookEventHandler; m_localWindowsHook.Install(); }
private void InstallHookButton_Click(object sender, EventArgs e) { _lowLevelKeyboardHook = new LocalWindowsHook(HookType.WH_KEYBOARD_LL, KeyBoardHookProc); using (Process curProcess = Process.GetCurrentProcess()) { using (ProcessModule curModule = curProcess.MainModule) { Text = curModule.ModuleName; _lowLevelKeyboardHook.Install(_lowLevelKeyboardHook.GetModuleID(curModule.ModuleName)); } } _lowLevelKeyboardHook.Install(_currentThreadId); }
public FocusManagerImpl(DockPanel dockPanel) { m_dockPanel = dockPanel; if (Win32Helper.IsRunningOnMono) { return; } m_hookEventHandler = new LocalWindowsHook.HookEventHandler(HookEventHandler); // Ensure the windows hook has been created for this thread if (sm_localWindowsHook == null) { sm_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET); sm_localWindowsHook.Install(); } sm_localWindowsHook.HookInvoked += m_hookEventHandler; }
protected override void Dispose(bool disposing) { if (!m_disposed && disposing) { if (!Win32Helper.IsRunningOnMono) { sm_localWindowsHook.HookInvoked -= m_hookEventHandler; } --_referenceCount; if (_referenceCount == 0 && sm_localWindowsHook != null) { sm_localWindowsHook.Dispose(); sm_localWindowsHook = null; } m_disposed = true; } base.Dispose(disposing); }
public FocusManagerImpl(DockPanel dockPanel) { m_dockPanel = dockPanel; if (Win32Helper.IsRunningOnMono) return; m_hookEventHandler = new LocalWindowsHook.HookEventHandler(HookEventHandler); // Ensure the windows hook has been created for this thread if (sm_localWindowsHook == null) { sm_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET); sm_localWindowsHook.Install(); } sm_localWindowsHook.HookInvoked += m_hookEventHandler; }
/// <summary> /// Shows the context menu /// </summary> /// <param name="handleOwner">Window that will get messages</param> /// <param name="arrFI">FileInfos (should all be in same directory)</param> /// <param name="pointScreen">Where to show the menu</param> public void ShowContextMenu(IntPtr handleOwner, FileInfo[] arrFI, Point pointScreen) { // Release all resources first. ReleaseAll(); IntPtr pMenu = IntPtr.Zero; LocalWindowsHook hook = new LocalWindowsHook(HookType.WH_CALLWNDPROC); hook.HookInvoked += new LocalWindowsHook.HookEventHandler(WindowsHookInvoked); try { //Application.AddMessageFilter(this); _arrPIDLs = GetPIDLs(arrFI); if (null == _arrPIDLs) { ReleaseAll(); return; } if (false == GetContextMenuInterfaces(_oParentFolder, _arrPIDLs)) { ReleaseAll(); return; } pMenu = CreatePopupMenu(); int nResult = _oContextMenu.QueryContextMenu( pMenu, 0, CMD_FIRST, CMD_LAST, CMF.EXPLORE | CMF.NORMAL | ((Control.ModifierKeys & Keys.Shift) != 0 ? CMF.EXTENDEDVERBS : 0)); //hook.Install(); uint nSelected = 0; try { nSelected = TrackPopupMenuEx( pMenu, TPM.RETURNCMD, pointScreen.X, pointScreen.Y, handleOwner, IntPtr.Zero); } catch { } DestroyMenu(pMenu); pMenu = IntPtr.Zero; if (nSelected != 0) { InvokeCommand(_oContextMenu, nSelected, _strParentFolder, pointScreen); } } catch { throw; } finally { //hook.Uninstall(); if (pMenu != IntPtr.Zero) { DestroyMenu(pMenu); } ReleaseAll(); } }
private void InstallHookButton_Click(object sender, EventArgs e) { _localMouseHook = new LocalWindowsHook(HookType.WH_MOUSE, MouseHookProc); _localMouseHook.Install(_currentThreadId); }
public FocusManagerImpl(DockPanel dockPanel) { m_dockPanel = dockPanel; if (Win32Helper.IsRunningOnMono()) return; m_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET); m_hookEventHandler = new LocalWindowsHook.HookEventHandler(HookEventHandler); m_localWindowsHook.HookInvoked += m_hookEventHandler; m_localWindowsHook.Install(); }
// Use a static instance of the windows hook to prevent stack overflows in the windows kernel. static FocusManagerImpl() { if (Win32Helper.IsRunningOnMono) return; sm_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET); sm_localWindowsHook.Install(); }
public FocusManagerImpl(DockPanel dockPanel) { m_dockPanel = dockPanel; if (!NativeMethods.ShouldUseWin32()) return; m_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET); m_hookEventHandler = new LocalWindowsHook.HookEventHandler(HookEventHandler); m_localWindowsHook.HookInvoked += m_hookEventHandler; m_localWindowsHook.Install(); }
public FocusManagerImpl(DockPanel dockPanel) { this._mDockPanel = dockPanel; this._mLocalWindowsHook = new LocalWindowsHook(HookType.WH_CALLWNDPROCRET); this._mHookEventHandler = this.HookEventHandler; this._mLocalWindowsHook.HookInvoked += this._mHookEventHandler; this._mLocalWindowsHook.Install(); }