private void OnHookEvent(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) { var windowTitle = WindowsFunctions.GetWindowTitle(hwnd); if (string.IsNullOrEmpty(windowTitle)) { return; } var processName = WindowsFunctions.GetProcessName(hwnd); if (string.IsNullOrEmpty(processName)) { return; } Fire(new AppTitleChanged(processName, windowTitle)); }