You'll need to use the GetForgroundWindow API and the SendMessage API to send the WM_GETTEXT message. Note that these are low-level Windows functions, not part of the .NET Framework. If you search the web you'll find examples of each, perhaps even both together.