I\'m trying to get the name of the executable of a window that is outside my C# 2.0 application. My app currently gets a window handle (hWnd) using the GetForegroundWindow()
You can call GetWindowThreadProcessId and that will return you the process associated with the window.
From that, you can call OpenProcess to open the process and get the handle to the process.