I have a C# program which outputs the foreground window using GetForegroundWindow().
It works fine until I minimise the foreground application by clicking on its icon from the task bar; When I open the same application by clicking on its icon from the task bar again, the GetForegroundWindow() returns zero. Windows version I am using is 8.1
Thanks