Beispiel #1
0
 public SystemForegroundTitleListener()
 {
     _HandleSystemForegroundEvent = HandleSystemForegroundEvent;
     _HandleObjectNamechangeEvent = HandleObjectNamechangeEvent;
     Refs.Set(ref hFocusedApplicationEvent,
              SetWinEventHook(Api.EVENT_SYSTEM_FOREGROUND, _HandleSystemForegroundEvent));
 }
 private SingleFileRowWriter EnsureOpenedLogFile(string fileName)
 {
     if (writer == null || writer.OpenedFile != fileName)
     {
         Refs.Set(ref writer, OpenLogFile(fileName));
     }
     return(writer);
 }
Beispiel #3
0
        private void HandleSystemForegroundEvent(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime)
        {
            if (hwnd == previousHwnd)
            {
                return;
            }
            var threadId = Api.GetWindowThreadProcessId(hwnd, out var processId);

            Refs.Set(ref hWindowTitleChangeEvent,
                     SetWinEventHook(Api.EVENT_OBJECT_NAMECHANGE, processId, threadId, _HandleObjectNamechangeEvent));
            previousHwnd = hwnd;
            FireForegroundTitleProbablyChanged();
        }