Here is my source code for locking my computer screen (Generally we do by pressing win+L)But Here in the below code what i am trying to do is , when user run the exe created by this application 1st the screen will be invisible (which is not happening in case of win+L) then next time when the user interact with the system it will show the user that the screen is locked .
int APIENTRY WinMain(HINSTANCE hInstance,
// Turn off monitor
Sleep(500); // Eliminate user's interaction for 500 ms
ret =SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);