This is an excellent contribution! It answers many questions I had with screensavers.
Only one question, why have you defined this:
long WINAPI Get_Foreground_Window();
#define PRAGMA_API Get_Foreground_Window;user32!GetForegroundWindow
In the windows.h file, there is already a GetForegroundWindow function, cant you use it directly?