重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

vb.net防任务管理器,vbs禁用任务管理器代码

VB 如何禁止打开任务管理器?

在应用程序里不提示的,只要再窗口载入时加入app.TaskVisible=False

子长ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:028-86922220(备注:SSL证书合作)期待与您的合作!

在进程里不显示有点复杂,要用到很多API函数

一个是窗口句柄一个需要的是程序进程句柄。

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const WM_CLOSE = H10

vb net 怎么样判断 Windows任务管理器进程,比如excel.exe存在侧button1

button1.visible=false

For Each i In Process.GetProcessesByName("excel")

button1.visible=true

next

vb 禁止结束进程本程序进程

专门针对任务管理器。

思路:将kernel32的TerminateProcess的首字节改为HC3,使TerminateProcess失效。

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 Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long

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 Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long

Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) 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 MAX_PATH As Integer = 260

Private Const PROCESS_ALL_ACCESS = H100000 + HF0000 + HFFF

Private Type PROCESSENTRY32

dwSize As Long

cntUseage As Long

th32ProcessID As Long

th32DefaultHeapID As Long

th32ModuleID As Long

cntThreads As Long

th32ParentProcessID As Long

pcPriClassBase As Long

swFlags As Long

szExeFile As String * 1024

End Type

Private Sub AntiKill()

On Error Resume Next

Dim MySnapHandle As Long

Dim hProcess As Long

Dim ProcessInfo As PROCESSENTRY32

Dim Addr As Long, hMod As Long

Dim ASM(0) As Byte

Dim sProcess As String

ASM(0) = HC3 'retn

hMod = GetModuleHandle("kernel32")

Addr = GetProcAddress(hMod, "TerminateProcess")

'Debug.Print Hex(Addr)

MySnapHandle = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0)

ProcessInfo.dwSize = Len(ProcessInfo)

If ProcessFirst(MySnapHandle, ProcessInfo) 0 Then

Do

sProcess = Left(LCase(ProcessInfo.szExeFile), InStr(ProcessInfo.szExeFile, ".") + 3)

If sProcess = "taskmgr.exe" Then

hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessInfo.th32ProcessID)

'Debug.Print hProcess

WriteProcessMemory hProcess, ByVal Addr, ByVal VarPtr(ASM(0)), 1, 0

'Debug.Print Err.LastDllError

CloseHandle hProcess

End If

Loop While ProcessNext(MySnapHandle, ProcessInfo) 0

End If

CloseHandle MySnapHandle

Err.Clear

End Sub

vb.net写的软件,运行后关闭所有的窗口后,发现在任务管理器的进程里还在运行,这是怎么回事

是不是调用了其他的程序,比方说excel之类的.

另外是写的隐藏还是退出?

又或者是使用了多线程?

在VB中实现禁用任务管理器?

禁用任务管理

把任务管理器改名

taskmgr.exe

改成其它名称

即可

按ALT+CTRL+DEL

也会无效

搜索所有的taskmgr.exe

(包括系统隐藏目录)

不禁用的时候改回来即可

这是最简单的方法

也很有效果

用VB自动实现改名称即可


网站标题:vb.net防任务管理器,vbs禁用任务管理器代码
文章网址:http://cqcxhl.com/article/phgjjh.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP