segunda-feira, 22 de novembro de 2010

Visual Basic :: Turn Monitor Off Or Place It On Standby...

Visual Basic :: Turn Monitor Off Or Place It On Standby...: "Turn Monitor Off Or Place It On Standby...

I have found this code splattered all over VBF, or code similar, which I have modified...

VB Code:
Option Explicit Private Declare Function SendMessage Lib 'user32' Alias 'SendMessageA' (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long Private Const WM_SYSCOMMAND = &H112Private Const SC_MONITORPOWER = &HF170 Private Sub cmdTurnOFF_Click() Debug.Print SendMessage(Form1.hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, 2&)End Sub Private Sub cmdStandby_Click() Debug.Print SendMessage(Form1.hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, 1&)End Sub Private Sub cmdTurnON_Click() Debug.Print SendMessage(Form1.hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, -1&)End Sub

But it doesn't work...I alwasy get a 0 returned from the SendMessage and the monitor does absolutely nowt

Anyone got any ideas?

Woka

– Enviado usando a Barra de Ferramentas Google"

Nenhum comentário: