Jump to content

Recommended Posts

Posted

Não sei se alguém já colocou isso aqui. De qualquer modo, tem pouco de útil até ... 😄

Enfim, o código é este, e usa a API do Windows.

Private Declare Function SendMessage Lib _
"user32" Alias "SendMessageA" (ByVal hWnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long


Const SC_MONITORPOWER = &HF170&
Const MONITOR_ON = -1&
Const MONITOR_OFF = 2&
Const WM_SYSCOMMAND = &H112

Dim x As Integer

Private Sub Form_Load()
Me.Hide
DoEvents
tmr.Enabled = True
End Sub

'isto é um timer.. ok?
Private Sub tmr_Timer()

    If x = 0 Then
     x = x + 1
    SendMessage Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_OFF
    Else
    SendMessage Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_ON
    x = 0
    End If
End Sub

'Anyway... o X pode ser uma variavel de estado booleana, mas as pessoas com o tempo aprendem o correcto. Bem, isso funcionava..

  • 11 months later...
  • 3 weeks later...
  • 10 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.