Beispiel #1
0
        static private bool ChildWindowCallback(IntPtr hwnd, IntPtr lparam)
        {
            var process = Process.GetProcessById(WinAPIFunctions.GetWindowProcessId(hwnd));

            if (process.ProcessName != "ApplicationFrameHost")
            {
                _realProcess = process;
            }
            return(true);
        }
Beispiel #2
0
        static public Process Find()
        {
            var foregroundProcess = Process.GetProcessById(WinAPIFunctions.GetWindowProcessId(WinAPIFunctions.GetforegroundWindow()));

            if (foregroundProcess.ProcessName == "ApplicationFrameHost")
            {
                foregroundProcess = GetRealProcess(foregroundProcess);
            }
            return(foregroundProcess);
        }
Beispiel #3
0
 static private Process GetRealProcess(Process foregroundProcess)
 {
     WinAPIFunctions.EnumChildWindows(foregroundProcess.MainWindowHandle, ChildWindowCallback, IntPtr.Zero);
     return(_realProcess);
 }