Exemple #1
0
        internal void SetHook()
        {
            lpfn = OnReceived;
            var lpfnPtr = Marshal.GetFunctionPointerForDelegate(lpfn);

            hhk = SetWindowsHookExW(Type, lpfnPtr, _hModule, 0);
        }
Exemple #2
0
        internal void SetHook()
        {
            lpfn = OnReceived;
            var lpfnPtr = Marshal.GetFunctionPointerForDelegate(lpfn);

            hhk = User32.SetWindowsHookEx(Type, lpfnPtr, _hModule, 0);

            MSG msg = new MSG();

            while (User32.GetMessage(ref msg, IntPtr.Zero, 0, 0) && !disposing)
            {
                User32.TranslateMessage(ref msg);
                User32.DispatchMessage(ref msg);
            }
        }