Your pm box is full ravin.
You may have an outdated sdk which is why this might not work for you. Try downloading latest platform sdk.
SPI_GETFOREGROUNDLOCKTIMEOUT is #defined as 0x2000
SPI_SETFOREGROUNDLOCKTIMEOUT is #defined as 0x2001
So you could try this...
DWORD timeout;
SystemParametersInfo(0x2000,0,&timeout,0);
SystemParametersInfo(0x2001,0,0,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
SetForegroundWindow(hwnd);
SystemParametersInfo(0x2001,0,&timeout,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);