Esempio n. 1
0
        private void HookCreateDestroyWindowEvent()
        {
            windowCreateDestroyHookCallback = new Win32Functions.WinEventDelegate(CreateDestroyWinEventProc);

            var hook = Win32Functions.SetWinEventHook(Win32Functions.EVENT_OBJECT_CREATE, Win32Functions.EVENT_OBJECT_DESTROY,
                                                      IntPtr.Zero, windowCreateDestroyHookCallback,
                                                      0, 0, Win32Functions.WINEVENT_OUTOFCONTEXT);
        }
Esempio n. 2
0
        private void HookForegroundWindowEvent()
        {
            windowForegroundHookCallback = new Win32Functions.WinEventDelegate(ForegroundWinEventProc);

            var hook = Win32Functions.SetWinEventHook(Win32Functions.EVENT_SYSTEM_FOREGROUND, Win32Functions.EVENT_SYSTEM_FOREGROUND,
                                                      IntPtr.Zero, windowForegroundHookCallback,
                                                      0, 0, Win32Functions.WINEVENT_OUTOFCONTEXT);
        }