<Windows API 불러오기>
'화면보호기 시간 설정 및 체크 후 화면보호기설정 창에 설정한 값 반영 API ===================
<DllImport("user32.dll", CharSet:=CharSet.Auto)>
Private Shared Function SystemParametersInfo(uAction As Integer, uParam As Integer, ByRef lpvParam As Integer, flags As Integer) As Boolean
End Function
Private Declare Function SystemParametersInfo2 Lib "user32" Alias "SystemParametersInfoW" (ByVal uiAction As Integer, ByVal uiParam As Integer,
ByRef lpenabled As Boolean, ByVal fWinIni As Integer) As Boolean
Private Const SPI_SETSCREENSAVERTIMEOUT As Integer = 15
Private Const SPIF_SENDWININICHANGE As Integer = 2
Public Shared Sub SetScreenSaverTimeout(Value As Int32)
Dim nullVar As Integer = 0
SystemParametersInfo(SPI_SETSCREENSAVERTIMEOUT, Value, nullVar, SPIF_SENDWININICHANGE)
End Sub
Private Const SPI_SETSCREENSAVESECURE As Integer = 119
Private Const SPIF_SENDWININICHANGE2 As Integer = &H2
Public Shared Sub SetScreenSaverIsSecure(Check As Integer)
SystemParametersInfo2(SPI_SETSCREENSAVESECURE, Check, False, SPIF_SENDWININICHANGE2)
End Sub
'===================================================================================
사용 코드
SetScreenSaverTimeout(설정하려는 시간이 들어가야함 숫자로)
SetScreenSaverIsSecure(1) (0은 체크해제, 1은 체크)
'VB.net' 카테고리의 다른 글
VB.NET DataSet, DataReader (0) | 2018.10.01 |
---|---|
VB.NET에서 정규식 사용하기 (0) | 2018.09.17 |
폴더 속성 변경 로직 (0) | 2018.08.27 |
DB연결하여 통합검색 개발 가이드 (0) | 2018.08.14 |
textbox 숫자를 날짜 형식으로 변경 (0) | 2018.07.17 |