public bool InstallHook(FormDebug frmDebug) { m_Debug = frmDebug; if (hHook.ToInt32() == 0) { // Create an instance of HookProc hookFunction = new CBTHookProc(CBTHookProcFn); hHook = SetWindowsHookEx(WH_CBT, hookFunction, IntPtr.Zero, new IntPtr(GetCurrentThreadId())); //Thread.CurrentThread.ManagedThreadId } // Return success status of SetWindowsHookEx return(hHook.ToInt32() != 0); }
public bool InstallHook(FormDebug frmDebug) { m_Debug = frmDebug; if (hHook.ToInt32() == 0) { // Create an instance of HookProc hookFunction = new CBTHookProc(CBTHookProcFn); hHook = SetWindowsHookEx(WH_CBT, hookFunction, IntPtr.Zero, new IntPtr(GetCurrentThreadId())); //Thread.CurrentThread.ManagedThreadId } // Return success status of SetWindowsHookEx return (hHook.ToInt32() != 0); }