Imports System.Runtime.InteropServices
Public Class ScreenLockForm
<DllImport("user32.dll")> _
Public Shared Function LockWorkStation() As Long
End Function
<DllImport("user32.dll")> _
Public Shared Function SendMessage(ByVal hWnd As IntPtr, _
ByVal uMsg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As Int32) As Int32
End Function
Private Const WM_SYSCOMMAND As Int32 = &H112
Private Const SC_SCREENSAVE As Int32 = &HF140
Private Sub Lock_Button_Click(sender As System.Object, e As System.EventArgs) _
Handles Lock_Button.Click
LockWorkStation()
SendMessage(Me.Handle, WM_SYSCOMMAND, SC_SCREENSAVE, 0)
Close()
End Sub
End Class
2012年6月25日月曜日
VB.NETでスクリーンロックしてスクリーンセーバー起動
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿