vb怎么禁用任务管理器

我想做个考试系统,怎么使用户打不开任务管理器,和开始菜单呀... 我想做个考试系统,怎么使用户打不开任务管理器,和开始菜单呀 展开
 我来答
小生怕鬼
2007-11-21 · 超过30用户采纳过TA的回答
知道答主
回答量:87
采纳率:0%
帮助的人:0
展开全部
Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function ProcessFirst Lib "kernel32" Alias "Process32First" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function ProcessNext Lib "kernel32" Alias "Process32Next" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Const MAX_PATH As Long = 260
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Const TH32CS_SNAPPROCESS = &H2
Private Const TH32CS_SNAPheaplist = &H1
Private Const TH32CS_SNAPthread = &H4
Private Const TH32CS_SNAPmodule = &H8
Private Const TH32CS_SNAPall = TH32CS_SNAPPROCESS + TH32CS_SNAPheaplist + TH32CS_SNAPthread + TH32CS_SNAPmodule
Private Const PROCESS_TERMINATE As Long = (&H1)

Private Sub Timer1_Timer()

Dim i As Long
Dim proc As PROCESSENTRY32
Dim snap As Long
Dim exename As String
Dim theloop As Long
Dim hand As Long
snap = CreateToolhelpSnapshot(TH32CS_SNAPall, 0) '获得进程“快照”的句柄
proc.dwSize = Len(proc)
theloop = ProcessFirst(snap, proc) '获取第一个进程,并得到其返回值
While theloop <> 0 '当返回值非零时继续获取下一个进程
exename = proc.szExeFile
If InStr(UCase(exename), "TASKMGR.EXE") <> 0 Then '将进程名全部转换成大写
hand = OpenProcess(PROCESS_TERMINATE, True, proc.th32ProcessID)
TerminateProcess hand, 0

End If
theloop = ProcessNext(snap, proc)
Wend

End Sub

设置好TIMER1的时间就可以了,可以结束任务管理器进程

Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Dim task As Long
Dim win As Long
Dim bswap As Boolean

Private Sub Command1_Click()
If Not bswap Then
SetParent win, Me.hwnd
ShowWindow win, 0
Else
SetParent win, task
ShowWindow win, 1
End If
bswap = Not bswap
End Sub

Private Sub Form_Load()
task = FindWindow("Shell_TrayWnd", vbNullString)
If task Then
win = FindWindowEx(task, 0, "Button", vbNullString)
If win Then
Else
MsgBox "没有找到开始按钮"
Unload Me
End If
Else
MsgBox "没有找到任务栏"
Unload Me
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
If bswap Then
SetParent win, task
ShowWindow win, 1
End If
End Sub

这段可以禁止开始,在程序退出后,恢复开始
深圳云诺科技
2024-11-11 广告
作为深圳云诺互联科技有限公司的一员,我们推荐使用先进的项目进度管理工具Project来高效管理项目。该工具集计划、跟踪与调整功能于一体,助力团队明确各阶段任务,合理分配资源,实时监控进度。通过直观的甘特图展示,项目延期风险一目了然,便于及时... 点击进入详情页
本回答由深圳云诺科技提供
44670
推荐于2016-10-04 · TA获得超过181个赞
知道小有建树答主
回答量:110
采纳率:0%
帮助的人:78.4万
展开全部
Option Explicit

Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Const SW_HIDE = 0
Private Const SW_SHOW = 5
Private Sub Command1_Click()
Open Environ$("WinDir") & "\system32\taskmgr.exe" For Binary As #1
Dim hLong As Long
Dim hwnd As Long

hwnd = FindWindow("Shell_TrayWnd", vbNullString)
hLong = FindWindowEx(hwnd, 0, "Button", vbNullString)
ShowWindow hLong, SW_HIDE
End Sub

Private Sub Command2_Click()
Close #1
Dim hLong As Long
Dim hwnd As Long

hwnd = FindWindow("Shell_TrayWnd", vbNullString)
hLong = FindWindowEx(hwnd, 0, "Button", vbNullString)
ShowWindow hLong, SW_SHOW
End Sub

高效的代码
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
XOooZzz
2007-11-21 · TA获得超过813个赞
知道小有建树答主
回答量:672
采纳率:0%
帮助的人:402万
展开全部
简单的办法是打开任务管理器并锁定读写:
Open Environ("windir") & "\system32\taskmgr.exe" For Binary Lock Read Write As 1
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式