OK,
i wanna be able to switch off my screen via code (using v/c)
looked through my old code and found this.... - it doesnt work though, comes out with Error 6: overflow, pointing to sendmessage....
now ive got a fresh xp install so maybe its something i havent set up correctly, so does this need something setting to be able to use it?
vb Code:
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long Const SC_MONITORPOWER = &HF170& Const MONITOR_ON = -1& Const MONITOR_OFF = 2& Const WM_SYSCOMMAND = &H112 Private Sub ControlScreenPower(bTurnOn As Boolean) Select Case bTurnOn Case True: 'Turn Monitor on: SendMessage Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_ON Case False: 'Turn Monitor off: SendMessage Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_OFF End Select End Sub 'me.hwnd = 2294342 ' WM_SYSCOMMAND= 274 ' sc_monitorpower = 61808 ' monitor on = -1 ' and off = 2
i havent actually tried it on another machine yet, but if you guys say its right ill make an install n check it on the other machine![]()




Reply With Quote