/// <summary> /// The child window callback. /// </summary> /// <param name="hwnd"> /// The hwnd. /// </param> /// <param name="lparam"> /// The lparam. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> private bool ChildWindowCallback(IntPtr hwnd, IntPtr lparam) { var process = Process.GetProcessById(WindowsApiFunctions.GetWindowProcessId(hwnd)); if (process.ProcessName != "ApplicationFrameHost") { this.realProcess = process; } return(true); }
/// <summary> /// The get foreground app. /// </summary> /// <returns> /// The <see cref="string"/>. /// </returns> public string GetForegroundApp() { var foregroundProcess = Process.GetProcessById(WindowsApiFunctions.GetWindowProcessId(WindowsApiFunctions.GetforegroundWindow())); if (foregroundProcess.ProcessName == "ApplicationFrameHost") { foregroundProcess = this.GetRealProcess(foregroundProcess); } if (foregroundProcess == null) { return(this.GetForegroundApp()); } else { return(foregroundProcess.ProcessName); } }