Exemplo n.º 1
0
        private void PerformDispose()
        {
            if (_hHook != IntPtr.Zero)
            {
                // uninstall hook
                UnhookWindowsHookEx(_hHook);
                _hHook = IntPtr.Zero;
            }

            _hookCallback = null;
        }
Exemplo n.º 2
0
		private void PerformDispose()
		{
			if (_hHook != IntPtr.Zero)
			{
				// uninstall hook
				UnhookWindowsHookEx(_hHook);
				_hHook = IntPtr.Zero;
			}

			_hookCallback = null;
		}
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of <see cref="CommonDialogHook"/>. Don't forget to <see cref="Dispose"/> it!
        /// </summary>
        public CommonDialogHook()
        {
            const int WH_CALLWNDPROCRET = 12;

#pragma warning disable 618,612
            // we have to use the unmanaged thread ID, and it should remain stable for the short lifetime of this hook anyway
            var unmanagedThreadId = AppDomain.GetCurrentThreadId();
#pragma warning restore 618,612

            _hookCallback = new CallWndRetProc(WndProcRetCallback);                                             // must be written this way to ensure the delegate instance does not go out of scope early
            _hHook        = SetWindowsHookEx(WH_CALLWNDPROCRET, _hookCallback, IntPtr.Zero, unmanagedThreadId); // install WndProcRet hook
        }
Exemplo n.º 4
0
		/// <summary>
		/// Initializes a new instance of <see cref="CommonDialogHook"/>. Don't forget to <see cref="Dispose"/> it!
		/// </summary>
		public CommonDialogHook()
		{
			const int WH_CALLWNDPROCRET = 12;

#pragma warning disable 618,612
			// we have to use the unmanaged thread ID, and it should remain stable for the short lifetime of this hook anyway
			var unmanagedThreadId = AppDomain.GetCurrentThreadId();
#pragma warning restore 618,612

			_hookCallback = new CallWndRetProc(WndProcRetCallback); // must be written this way to ensure the delegate instance does not go out of scope early
			_hHook = SetWindowsHookEx(WH_CALLWNDPROCRET, _hookCallback, IntPtr.Zero, unmanagedThreadId); // install WndProcRet hook
		}
Exemplo n.º 5
0
 private static extern IntPtr SetWindowsHookEx(int hookType, CallWndRetProc lpfn, IntPtr hMod, int dwThreadId);
Exemplo n.º 6
0
		private static extern IntPtr SetWindowsHookEx(int hookType, CallWndRetProc lpfn, IntPtr hMod, int dwThreadId);