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()
What exactly is it that you're trying to do? You can get the process ID of the the process which created a window with GetWindowThreadProcessId(), followed by OpenProcess() to get the process handle. But this seems very kludgy, and I feel like there's a more elegant way to do what you want to do.