Click to See Complete Forum and Search --> : Windows 9x Standby/suspend/video down
Mad Compie
Aug 3rd, 2000, 01:48 PM
Is there any API that could execute the Windows' power saving routines like "Standby", "Suspend", "HD power down" or "Video off"?
This was suppose to be a code to start the screen saver, for some reason, not sure if it's just my computer, it goes to StandBy mode.
Public Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hWnd As Long, ByVal _
wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetDesktopWindow Lib "user32" () As Long
Public Const WM_SYSCOMMAND As Long = &H112&
Public Const SC_SCREENSAVE As Long = &HF140&
Function StandBy() As Boolean
Dim hWnd&
On Error Resume Next
hWnd& = GetDesktopWindow()
Call SendMessage(hWnd&, WM_SYSCOMMAND, SC_SCREENSAVE, 0&)
StandBy = (Err.Number = 0)
End Function
Usage:
Call StandBy
Mad Compie
Aug 9th, 2000, 12:22 PM
Yes of course my dear Compie!
Why not help myself if nobody else do it?
Public Declare Function SetSystemPowerState Lib "kernel32" (ByVal fSuspend As Long, ByVal fForce As Long) As Long
-> fSuspend has no meaning
-> fForce: 0=prompt, 1=no prompt (immediately)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.