Monday, May 28, 2012

Fungsi Untuk Memeriksa Apakah Screen Saver Enable

Di bawah ini merupakan fungsi untuk memeriksa apakah screen saver enable atau disable? enable return true dan jika disable, apalagi jika bukan return false.
Option Explicit 

Private Declare Function
SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const
SPI_GETSCREENSAVEACTIVE = 16

Private Function
IsScreenSaverEnable() As Boolean
Dim
bReturn As Boolean
Dim
bActive As Boolean
Call
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, vbNull, bReturn, 0)
IsScreenSaverEnable = bReturn
End Function
Contoh penggunaan fungsi untuk memeriksa apakah screen saver enable
Private Sub Command1_Click() 
MsgBox IsScreenSaverEnable
End Sub