How can i use windows.h library

i want to know on how can i turn off the display of my computer's monitor screen. i know that there is a way using windows.h and SendMessage() i tried it with C++ but when i tried it with arduino sketch it says that it is not declared

Here is what i want

#include "windows.h"

...
void SCREENOFF(){
   Serial.println("SCREEN TURNS OFF"); // turn off screen
   SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
}
...

if i call the SCREENOFF() from my code inside the void loop() the screen display of my monitor should be turned off =(
or maybe there is another way to turn off the display of my monitor??
plss HELP

i want to know on how can i turn off the display of my computer's monitor screen.

From an Arduino you can't.
All you can do from an arduino is to send a message to your computer through the serial port. Then on your computer you must have a program running that looks at the serial port and when it sees that message turns off your monitor.

Grumpy_Mike:

i want to know on how can i turn off the display of my computer's monitor screen.

From an Arduino you can't.
All you can do from an arduino is to send a message to your computer through the serial port. Then on your computer you must have a program running that looks at the serial port and when it sees that message turns off your monitor.

okay so...

arduino sends a message via a COM PORT (for example COM4) ----> sends to the pc ----> then a program (like in JAVA) reads from the COM PORT (COM4) reads the message --> the turn off the display

okay so...

arduino sends a message via a COM PORT (for example COM4) ----> sends to the pc ----> then a program (like in JAVA) reads from the COM PORT (COM4) reads the message --> the turn off the display

Yes :slight_smile: