I have Windows 10 64 bit, and I spend a lot of time programming behind the screen. I need to break from time to time and limit the light / radiation of the screen from a collision with my head, making the screen black, as if turned off.
What I can do is go to the login screen, but I need to see BLACK for it to be released! What really hopes to achieve is a black screen that you get once inactive. Can I do this programmatically?
Here is the code I have had so far:
#include <Windows.h>
#define KEY_DOWN(key) ((::GetAsyncKeyState(key) & 0x80000) ? 1 : 0)
#define KEY_UP(key) ((::GetAsyncKeyState(key) & 0x80000) ? 0 : 1)
int main(void)
{
HWND hWnd;
AllocConsole();
hWnd = FindWindowA("ConsoleWindowClass", NULL);
ShowWindow(hWnd, 0);
while (1)
{
if (::GetAsyncKeyState('L') == -32767)
{
if (KEY_DOWN(VK_CONTROL) && KEY_DOWN(VK_MENU))
LockWorkStation();
}
if (::GetAsyncKeyState('E') == -32767)
{
if (KEY_DOWN(VK_CONTROL))
return 0;
}
}
return 0;
}
source
share