你好:

     感谢你访问我的 Blog ,本博客只提供博主的技术经验分享,你可以在此做简单的留言和评论,我会抽空回复你;若是要深入交流探讨,请联系QQ:47853253或者加QQ群:12012081


 

万象,登录,锁定,注销,自动回车,切换用户

命令锁定计算机:

rundll32.exe user32.dll,LockWorkStation

 

禁止用户锁定计算机:

HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Policies/System,,,在右边区域,右击创建一个DWORD值,名为DisableLockWorkstation,赋值说明:

  * 1 - 表示禁用锁定计算机

 

  * 0 - 表示开启锁定计算机

 

 

 #NoTrayIcon

#Region ;**** 由 AccAu3Wrapper_GUI 创建指令 ****
#AccAu3Wrapper_OutFile_x64=万象自动回车.exe
#AccAu3Wrapper_Res_Language=2052
#AccAu3Wrapper_Res_requestedExecutionLevel=None
#EndRegion ;**** 由 AccAu3Wrapper_GUI 创建指令 ****
Break(0)
Opt("TrayIconHide", 3) 
Global Const $NOTIFY_FOR_THIS_SESSION = 0x0
Global Const $NOTIFY_FOR_ALL_SESSIONS = 0x1
Global Const $WM_WTSSESSION_CHANGE = 0x2B1
Global Const $WTS_CONSOLE_CONNECT = 0x1
Global Const $WTS_CONSOLE_DISCONNECT = 0x2
Global Const $WTS_REMOTE_CONNECT = 0x3
Global Const $WTS_REMOTE_DISCONNECT = 0x4
Global Const $WTS_SESSION_LOGON = 0x5
Global Const $WTS_SESSION_LOGOFF = 0x6
Global Const $WTS_SESSION_LOCK = 0x7
Global Const $WTS_SESSION_UNLOCK = 0x8
Global Const $WTS_SESSION_REMOTE_CONTROL = 0x9
 
Global $hGUI = GUICreate("Message Sink", 0, 0,0,0); GUI to receive notification
Global $sMsg = "$hGUI = " & $hGUI & @CRLF
Global $ctrlEdit = GUICtrlCreateEdit($sMsg, 10, 10, 380, 580)
GUISetState()
 
GUIRegisterMsg($WM_WTSSESSION_CHANGE, "_WM_WTSSESSION_CHANGE")
DllCall("Wtsapi32.dll", "int", "WTSRegisterSessionNotification", "hwnd", $hGUI, "dword", $NOTIFY_FOR_THIS_SESSION)
;DllCall("Kernel32.dll", "none", "Sleep", "dword", 1000)
;DllCall("User32.dll", "int", "LockWorkStation")
;DllCall("User32.dll", "int", "UNLockWorkStation")
While 1
WinSetState  ( "Message Sink", "", @SW_HIDE )
    If GUIGetMsg() = -3 Then ExitLoop
WEnd
DllCall("Wtsapi32.dll", "int", "WTSUnRegisterSessionNotification", "hwnd", $hGUI)
 
Func _WM_WTSSESSION_CHANGE($hWnd, $iMsgID, $wParam, $lParam)
    $sMsg &= @CRLF & @HOUR & ":" & @Min & ":" & @SEC & " = "
    Switch $wParam
        Case $WTS_CONSOLE_CONNECT
            $sMsg &= "A session was connected to the console terminal."
        Case $WTS_CONSOLE_DISCONNECT
            $sMsg &= "A session was disconnected from the console terminal."
        Case $WTS_REMOTE_CONNECT
            $sMsg &= "A session was connected to the remote terminal."
        Case $WTS_REMOTE_DISCONNECT
            $sMsg &= "A session was disconnected from the remote terminal."
        Case $WTS_SESSION_LOGON
            $sMsg &= "A user has logged on to the session."
        Case $WTS_SESSION_LOGOFF
            $sMsg &= "A user has logged off the session."
        Case $WTS_SESSION_LOCK
DllCall("User32.dll", "int", "UNLockWorkStation")
Send ("{ENTER}")
Sleep(1000)
Send ("{ENTER}")
Sleep(1000)
Send ("{ENTER}")
Sleep(1000)
Exit
            $sMsg &= "A session has been locked."
        Case $WTS_SESSION_UNLOCK
            $sMsg &= "A session has been unlocked."
        Case $WTS_SESSION_REMOTE_CONTROL
            $sMsg &= "A session has changed its remote controlled status."
    EndSwitch
    $sMsg &= @CRLF & "$hWnd = " & $hWnd & @CRLF & _
            "$iMsgID = 0x" & Hex($iMsgID, 8) & @CRLF & _
            "$wParam = " & $wParam & @CRLF & _
            "$lParam = " & $lParam & @CRLF
    ControlSetText($hGUI, "", $ctrlEdit, $sMsg)
EndFunc


文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
评论: 0 | 引用: 0 | 查看次数: 181
发表评论
你没有权限发表留言!