As in the topic... or better - how to get this information from events when the top window changes?
For the window title, you'll have to do a P/Invoke of GetWindowText with the HWND returned from GetForegroundWindow().
As for the process info, I believe that P/Invoking GetWindowModuleFileName should work.