继续提问vb的锁屏问题

本人初学vb!有两个form,主要的内容在form1上,当点击form1上的锁定屏幕时,form2会弹出覆盖住form1(form2是半透明的),以此来达到锁屏的目的,有... 本人初学vb!有两个form,主要的内容在form1上,当点击form1上的锁定屏幕时,form2会弹出覆盖住form1(form2是半透明的),以此来达到锁屏的目的,有谁能提提供一下锁屏的代码,鼠标、键盘ALT+ctrl+delete锁住的代码啊?我这个弄得不是很顺利,求大侠赐教代码
可否告诉限制win和任务管理器的代码呢?因为form2是全屏的,鼠标就不用管啦,在哪个地方写,请写清楚些,麻烦了,我电脑用的win7的系统
Private Sub Form_Load()
Open Environ("windir") & "\system32\taskmgr.exe" For Input Lock Read Write As #1
'一句简单话就可以把ctrl+alt+del禁止
Me.WindowState = 2
Dim rtn As Long
rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong hwnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes hwnd, 0, 150, LWA_ALPHA
End Sub
Private Sub Form_Unload(Cancel As Integer)
Close #1
这个咋不行呢??
展开
 我来答
xiaorf
2014-01-17 · 超过22用户采纳过TA的回答
知道答主
回答量:107
采纳率:0%
帮助的人:66.5万
展开全部
==============窗体上的代码==================Private Sub Form_Load()Dim a As
LongHooKalls = FindWindow(vbNullString, "Windows 任务管理器")If alls <>
0 ThenSendMessage alls, WM_CLOSE, 0, ByVal 0&End If'Form2.Showa =
GetWindow(Me.hwnd, GW_OWNER)SetWindowPos a, HWND_TOPMOST, 0, 0, 0, 0,
SWP_SHOWWINDOWS = Environ("windir")S = S + "\system32\taskmgr.exe"Open S
For Random Lock Read As #1Call SetAutoRun(True)End
Sub==============模块上的代码=============Option ExplicitPublic Declare
Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal
hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal
dwType As Long, lpData As Any, ByVal cbData As Long) As LongPublic
Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA"
(ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As
LongPublic Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As LongPublic
Declare Function RegDeleteValue Lib "advapi32.dll" Alias
"RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As
LongPublic Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As LongPublic Const GW_OWNER = 4Public Const REG_SZ = 1Public
Const HKEY_LOCAL_MACHINE = &H80000002Public Declare Function
FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As
String, ByVal lpWindowName As String) As LongPublic Declare
Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal
hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As
Long, ByVal cy As Long, ByVal wFlags As Long) As LongPublic Declare
Function SetFocus Lib "user32" (ByVal hwnd As Long) As LongPublic Const SWP_SHOWWINDOW = &H40Public
Const HWND_TOPMOST = -1Public Const SWP_NOMOVE = &H2Public Const
SWP_NOSIZE = &H1Private Declare Function CallNextHookEx Lib "user32"
(ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam
As Any) As LongPrivate Declare Function SetWindowsHookEx Lib "user32"
Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long,
ByVal hmod As Long, ByVal dwThreadId As Long) As LongPrivate Declare
Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As
LongPrivate Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory"
(Destination As Any, Source As Any, ByVal Length As Long)Public Declare
Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As
Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As
LongPublic Const WM_CLOSE = &H10Private Type PKBDLLHOOKSTRUCTvkCode As LongscanCode As Longflags As Longtime As LongdwExtraInfo As LongEnd TypePrivate Const WM_KEYDOWN = &H100Private Const WM_SYSKEYDOWN = &H104Private Const WM_KEYUP = &H101Private Const WM_SYSKEYUP = &H105Private Const VK_TAB = &H9Private Const VK_LWIN = &H5BPrivate Const VK_RWIN = &H5CPrivate Const VK_ESCAPE = &H1BPrivate Const VK_F4 = &H73Private Const HC_ACTION = 0Private Const WH_KEYBOARD_LL = 13Private lngHook As Long'使用底层KeyboardHook拦截按键消息Public Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As LongDim blnHook As BooleanDim p As PKBDLLHOOKSTRUCTIf nCode = HC_ACTION Then Select Case wParam Case WM_KEYDOWN, WM_SYSKEYDOWN, WM_KEYUP, WM_SYSKEYUP Call CopyMemory(p, ByVal lParam, Len(p)) If p.vkCode = VK_LWIN Or p.vkCode = VK_RWIN Then '按下了左/右Win键 blnHook = True
End If If p.vkCode = VK_TAB Then blnHook = True
End If If p.vkCode = VK_ESCAPE Then blnHook =
True End If If p.vkCode = VK_F4 Then
blnHook = True End IfCase ElseEnd SelectEnd If If blnHook Then LowLevelKeyboardProc = 1 Else Call CallNextHookEx(WH_KEYBOARD_LL, nCode, wParam, lParam) End IfEnd FunctionPublic Sub HooK() lngHook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0)End SubPublic Sub UnHooK() Call UnhookWindowsHookEx(lngHook)End SubPublic Sub SetAutoRun(ByVal Autorun As Boolean)
Dim KeyId As Long Dim MyexePath As String Dim regkey As String
MyexePath = App.Path & "\" & App.EXEName & ".exe"
regkey = "Software\Microsoft\Windows\CurrentVersion\Run" Call RegCreateKey(HKEY_LOCAL_MACHINE, regkey, KeyId) If Autorun Then RegSetValueEx KeyId, "MySoftware", 0&, REG_SZ, ByVal MyexePath, LenB(MyexePath) Else RegDeleteValue KeyId, "MySoftware" End If RegCloseKey KeyIdEnd Sub
追问
完全看不懂这个是啥
百事牛
2024-10-28 广告
若Excel表设置了保护且不知密码,可尝试使用奥凯丰E电商平台CEL解密大师的解除限制功能。只需将Excel文件添加到软件中,点击开始按钮,即可尝试撤销工作表保护,无需找回密码。此方法简便快捷,能有效解决因忘记密码而无法编辑Excel文件的... 点击进入详情页
本回答由百事牛提供
权群28
2014-01-29 · TA获得超过750个赞
知道小有建树答主
回答量:513
采纳率:100%
帮助的人:214万
展开全部
Open Environ("windir") & "\system32\taskmgr.exe" For Input Lock Read Write As #1
'一句简单话就可以把ctrl+alt+del禁止
这个只是二进制方式读取任务管理器这个程序,虽然用了Lock这个方式、完全不起作用。
还有 GWL_EXSTYLE 这个常量值没定义。
还要让这个窗体置顶.
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2014-01-23
展开全部
股份已发货的人的规划搞飞机和规划局
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式