Go Down

Topic: How can i use windows.h library (Read 1 time) previous topic - next topic

WaynnWade

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

Code: [Select]

#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

Grumpy_Mike

Quote
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.

WaynnWade


Quote
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

Grumpy_Mike

Quote
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  :)

Go Up