找回密码
 加入
搜索
查看: 3367|回复: 0

[系统综合] 求锁屏后按键盘指定键解锁

[复制链接]
发表于 2011-4-1 20:39:34 | 显示全部楼层 |阅读模式
需要一个很简单的锁屏(背景色需半透明,并显示“已锁屏,按K键解锁”)

以下的太复杂了,请懂的哥们秀一个,谢谢!

#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=D:\autoit3\Aut2Exe\Icons\lock.ico
#AutoIt3Wrapper_outfile=网吧挂机锁.exe
#AutoIt3Wrapper_Res_Comment=网吧挂机锁,网管小朱制作,设置了不可更改的超级密码
#AutoIt3Wrapper_Res_Description=太阳雨专用版
#AutoIt3Wrapper_Res_Fileversion=1.0
#AutoIt3Wrapper_Res_LegalCopyright=1.0
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)
FileInstall("logo.jpg",@TempDir & "\logo.jpg") ;图标
FileInstall("lock.jpg",@TempDir & "\lock.jpg")
FileInstall("WinLockDll.dll",@TempDir & "\WinLockDll.dll")
Dim $dll


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("网吧挂机锁 1.0", 338, 147)
GUISetBkColor(0xD8E4F8)
GUISetOnEvent($GUI_EVENT_CLOSE, "delfile")
$Group1 = GUICtrlCreateGroup("", 8, 0, 321, 137)
$Pic1 = GUICtrlCreatePic(@TempDir &"\logo.jpg", 16, 16, 108, 108, 0, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE,$GUI_WS_EX_PARENTDRAG))
$Label1 = GUICtrlCreateLabel("输入密码:", 144, 24, 64, 17)
$Label2 = GUICtrlCreateLabel("确定密码:", 144, 64, 64, 17)
$Input1 = GUICtrlCreateInput("", 208, 20, 105, 21, $ES_PASSWORD, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$Input2 = GUICtrlCreateInput("", 208, 60, 105, 21, $ES_PASSWORD, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$Button1 = GUICtrlCreateButton("开始挂机", 144, 96, 67, 25, $WS_GROUP, $WS_EX_STATICEDGE)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
GUICtrlSetOnEvent(-1, "lock")
$Button2 = GUICtrlCreateButton("安全退出", 248, 96, 67, 25, $WS_GROUP, $WS_EX_STATICEDGE)
GUICtrlSetOnEvent(-1, "delfile")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###     ;====>锁定前的窗体

#Region ### START Koda GUI section ### Form=
$aForm1 = GUICreate("网吧专用挂机锁", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
$aSlider1 = GUICtrlCreateSlider(@DesktopWidth - 280, @DesktopHeight - 82, 240, 33)   ;在GUI上创建一个滑动条(Slider)控件
GUICtrlSetLimit(-1, 250, 80) ;设置最大值为250,最小值为30(设置某些控件的字符数或象素数限制.)
GUICtrlSetData(-1, 180)   ;设置值为150
GUICtrlSetBkColor(-1, $GUI_Bkcolor_Transparent)
$aInput1 = GUICtrlCreateInput("", @DesktopWidth - 280, @DesktopHeight - 180, 153, 21, $ES_PASSWORD, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$aButton1 = GUICtrlCreateButton("解锁", @DesktopWidth - 100, @DesktopHeight - 182, 51, 25,$WS_GROUP, $WS_EX_STATICEDGE)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
GUICtrlSetOnEvent(-1, "unlock")
$Pic1 = GUICtrlCreatePic(@TempDir & "\lock.jpg", 0 , 0,@DesktopWidth, @DesktopHeight, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$aLabel1 = GUICtrlCreateLabel("开始挂机时间:"&@HOUR&":"&@MIN&":"&@SEC, @DesktopWidth - 280, @DesktopHeight - 142, 150, 17)
GUICtrlSetBkColor(-1, $GUI_Bkcolor_Transparent)   ;使标签背景透明
GUICtrlSetColor(-1, 0x808080)
$aLabel2 = GUICtrlCreateLabel("本工具由太阳雨网城提供", @DesktopWidth - 280, @DesktopHeight - 112, 208, 17)
GUICtrlSetColor(-1, 0x808080)
GUICtrlSetBkColor(-1, $GUI_Bkcolor_Transparent)
#EndRegion ### END Koda GUI section ###   ;====>锁定后的窗体

While 1
        WinSetTrans ( $aForm1, "", GUICtrlRead($aSlider1) ) ; 设置指定窗口的透明度(WinSetTrans ( "窗口标题", "窗口文本", 透明度 ))
        Sleep(100)
WEnd  ;==== while

Func Lock()
$mima1=GUICtrlRead($Input1)
$mima2=GUICtrlRead($Input2)
if $mima1<>$mima2 or $mima1 = "" Then
        MsgBox(16,"特别注意!","两次输入的不一样或密码为空! ",10)
        GUICtrlSetData($Input1,"")
        GUICtrlSetData($Input2,"")
ElseIf StringLen ($mima1) < 4 Then
        MsgBox(16,"特别注意!","输入的密码长度必须4位以上! ",10)
        GUICtrlSetData($Input1,"")
        GUICtrlSetData($Input2,"")
Else
        RegWrite("HKLM\Software\pclock","password","REG_SZ",$mima1)  ;把密码写入注册表
        $dll = DllOpen(@TempDir & "\WinLockDll.dll")
        DllCall($dll, "int", "StartButton_Show_Hide", "int",0)
        DllCall($dll, "int", "Taskbar_Show_Hide", "int", 0)
        DllCall($dll, "int", "CtrlAltDel_Enable_Disable", "int", 0)
        DllCall($dll, "int", "AltTab1_Enable_Disable", "int", 0)
        DllCall($dll, "int", "AltTab2_Enable_Disable", "int", 0, "int", 0)
        DllCall($dll, "int", "TaskSwitching_Enable_Disable", "int", 0)
        DllCall($dll, "int", "TaskManager_Enable_Disable", "int", 0)
        GUISetState(@SW_HIDE,$Form1)
        GUISetState(@SW_SHOW,$aForm1)
EndIf

EndFunc   ;=====>lock


Func unLock()
$mima1=GUICtrlRead($aInput1)
$mima2=RegRead("HKLM\Software\pclock","password")
If $mima1 = $mima2 or $mima1 = "xiaozhu" Then
        DllCall($dll, "int", "StartButton_Show_Hide", "int", 1)
        DllCall($dll, "int", "Taskbar_Show_Hide", "int", 1)
        DllCall($dll, "int", "CtrlAltDel_Enable_Disable", "int", 1)
        DllCall($dll, "int", "AltTab1_Enable_Disable", "int", 1)
        DllCall($dll, "int", "AltTab2_Enable_Disable", "int", 1, "int", 1)
        DllCall($dll, "int", "TaskSwitching_Enable_Disable", "int", 1)
        DllCall($dll, "int", "TaskManager_Enable_Disable", "int", 1)
        DllClose($dll)
        delfile()
Else
        GUICtrlSetData($aInput1,"")  ;清除输入框数据
        ControlFocus ( $aForm1, "", $aInput1)  ;设置焦点
EndIf
EndFunc  ;====>unlock

Func delfile()
        FileDelete(@TempDir & "\logo.jpg")
        FileDelete(@TempDir & "\lock.jpg")
        FileDelete(@TempDir & "\WinLockDll.dll")
        Exit
EndFunc
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-15 10:27 , Processed in 0.074249 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表