Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

C++ app that turns off Monitor

Well Guys i was Really bored Today so I wanted to make a C++ console application. This application lets your Monitor Sleep for a few seconds.

I added comments so you guys who are new to C++ can understand the code.
Link:w ww.mediafire.com/download/36gw25c6ouvhzb2/ TurnOffMonitor.rar

I placed some spaces since i cant make a link yet so yea Enjoy.
Code
#include <Windows.h>

int main()
{
    //turns off Monitor
    SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)2);
    Sleep(5000); // the Monitor is turned off for 5 seconds
    //(Down) This line off code turns the monitor Back on.
    SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)-1);
    return 0;
    // Returning 0 shuts off the application, so to run it again you would have to start it again.

}

Well looks like i made a mistake, if u have Visual Studio 2015 or probably any VS start it and you will see the effects.
Screen cuts on with key input or mouse movent
it works perfect :) i love it :D


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by SalacityJun 10, 2018 11:57 AM 3 173 Jun 10, 2018 11:57 AM
Last Post: Sir-Teabag
[Python] by MalentorJul 14, 2017 10:27 AM 16 518 Jul 14, 2017 10:27 AM
Last Post: Malentor
[.NET] by FộrcədAug 10, 2013 06:43 AM 30 1,825 Aug 10, 2013 06:43 AM
Last Post: Drug ballad