I found this on google:
Version 1:
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2); //turn off
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, -1); //turn on
Version 2:
HWND h = FindWindow(0, 0);
SendMessage(h, WM_SYSCOMMAND, SC_MONITORPOWER, 2);
SendMessage(h, WM_SYSCOMMAND, SC_MONITORPOWER, -1);
On my laptop(Win8.1+Visual Studio 2010): For both versions, turnoff works but turnon doesn't. When turnon code is executed, the screen is on and then off again immediately.
Another interesting thing: on my desktop(Win8.1+VS2013), the program will stuck on either line of version 1. But, it can go through version 2. Turn off works, but turn on is totally ineffective.