By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!From: TonyT
| Reboot /M1 powers the monitor off. Is there a way to query in a batch
| file if the monitor is actually off? (My batch file occasionally
| ftp's the screen @snapshot[] and it would be nice to know if the
| screen is on or off).
When the monitor is turned off by REBOOT /M1 (or its equivalent), would @SNAPSHOT return the "virtual screen", i.e., that which would be displayed if the monitor were on?
A question similar to the one in the OP that's related to REBOOT /W: would internal variables _READY and _HDRIVES indicate whether or not the disk drive power is currently on?
--
Steve
The PC is under my control, unattended far away. I basically want the monitor off all the time to save power and not burn a hole in the laptop screen etc.. So I issue a monitor off command.
# Monitors = 4
[Default Monitor]
PowerState = 1
[Default Monitor]
PowerState = 1
[Dell 1908FP(Digital)]
PowerState = 1
[Plug and Play Monitor]
PowerState = 1
# Monitors = 4
[Default Monitor]
PowerState = 4, *** Sleeping State ***
[Default Monitor]
PowerState = 4, *** Sleeping State ***
[Dell 1908FP(Digital)]
PowerState = 4, *** Sleeping State ***
[Plug and Play Monitor]
PowerState = 4, *** Sleeping State ***
# Monitors = 4
[Default Monitor]
PowerState = 1
Thanks for your interesting idea. I searched the registry for "PowerState" but only found Settings nothing for state. Even windows own powercfg does not report the state, just settings.
HANDLE hLCD = CreateFile(L"\\\\.\\LCD", GENERIC_READ | GENERIC_WRITE, 0,
0, OPEN_EXISTING, 0, 0);
BOOL bOn;
if ( GetDevicePowerState (hLCD, &bOn) )
wprintf(L"State: %d\n", bOn);
else
wprintf(L"Failed: %d\n", GetLastError());
CloseHandle(hLCD);
g:\projects\test\release> test.exe
State: 1
g:\projects\test\release> monitor off & delay 10 & test.exe
State: 0
int main()
{
INT rv = -1;
HANDLE hLCD CreateFile(L"\\\\.\\LCD", GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
BOOL bOn;
if ( GetDevicePowerState (hLCD, &bOn) )
rv = bOn ? 1 : 0;
else
wprintf(L"GetDevicePowerState failed: %d\n", GetLastError());
CloseHandle(hLCD);
wprintf(L"%d\n", rv);
return rv;
}
Nothing wrong with Fortran.(expert in Fortran that tells my age)
I rather doubt that you will because there are no includes for the header files in Vince's source code.I could not compile the code yet with TinyC
Perhaps not, and with something like the Open Watcom compiler it ought to be possible to convert Vince's program :)Nothing wrong with Fortran.
There is a "feedback" button on the left side of the webpage that you can click to go to a forum where you can post suggestions for new features.Rex Conn: Any possibility to incorporate his method to make a new internal variable _MonitorStatus[] in a future release of TCC that shows if a monitor is on or in sleeping state?
I have to admit to never having used the Fortran (and indeed the last time I did anything with Fortran - converting Dungeon to run on IBM's mainframe VM OS for a bureau's games system - was back in the early 1980s) but I have used Open Watcom C for virtually the whole of its existence, since my employer previously used the commercial Watcom C for the Windows version of our cross-platform tools.I am looking forward to playing with that and some C programs I use
Any possibility to incorporate his method to make a new internal variable _MonitorStatus[] in a future release of TCC that shows if a monitor is on or in sleeping state?
v:\> help @video
@VIDEO[N] = 1/0/-1 (on/sleeping/error) for monitor N = 0,1,...
v:\> for /l %i in (0,1,3) echo %@video[%i]
1
1
1
1
v:\> reboot /m1 & delay 15 & for /l %i in (0,1,3) echo %@video[%i]
0
0
0
0
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96E-E325-11CE-BFC1-08002BE10318}
> Code:
> ---------
> v:\> help @video
> @VIDEO[N] = 1/0/-1 (on/sleeping/error) for monitor N = 0,1,...
>
> v:\> for /l %i in (0,1,3) echo %@video[%i]
> 1
> 1
> 1
> 1
>
> v:\> reboot /m1 & delay 15 & for /l %i in (0,1,3) echo %@video[%i]
> 0
> 0
> 0
> 0
> ---------
> It's a highly specialized function so I don't mind the user
> having to look in
>
>
> Code:
> ---------
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D3
> 6E96E-E325-11CE-BFC1-08002BE10318}
> ---------
> to see how many devices exist and their descriptions ... and
> to experiment as to which of them suit his purposes.
>
> I have two physical monitors attached to a Dell WKS here.
> And here that registry key enumerates 4 devices; their
> descriptions are: "Default Monitor", "Default Monitor", "Dell
> 1908FP(Digital)", and "Plug and Play Monitor" (a bit
> confusing). In my tests, I always get the same result for all 4.
>
> Tony, would that suit your purposes? Comments, anyone?
I believe that Windows always returns the state of the 'primary display', which makes senseIn my tests, I always get the same result for all 4
What "I'D" really like @execstr[] to return more than "first" line ...
example exesctr[fc whatever,1]
as an example - fc.exe returns the command parameters while the second
line produces the result I want
"FC: no differences encountered" -a- Plugin would work just as well