예제 #1
0
 public static void StartMonitoringActiveAppChangesIfNeeded()
 {
     if (ShouldMonitorActiveAppChange() && CurrentHook == IntPtr.Zero)
     {
         _handler    = new WinEventHookProc(OnActiveWindowChanged);
         CurrentHook = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, IntPtr.Zero, _handler, 0, 0, WINEVENT_OUTOFCONTEXT);
     }
 }
예제 #2
0
 static extern IntPtr SetWinEventHook(uint eventMin, uint eventMax, IntPtr hmodWinEventProc, WinEventHookProc lpfnWinEventProc, uint idProcess, uint idThread, uint dwFlags);