How do you know which process has the current focus?
Edit: Windows OS, anywhere from XP to 7
Call GetForegroundWindow to get the handle of the focused window, and then call GetWindowThreadProcessId to get the ID of the process that created this window. What you do with this ID is up to you.
GetForegroundWindow
GetWindowThreadProcessId
You can use EnumProcesses to get a list of running processes.
EnumProcesses
After you retrieve the descriptors, check out GetProcessInformation , maybe something may help you.
GetProcessInformation
the first steps are the winapi EnumProcesses function (and possibly OpenProcess)