vb.net中如何禁止从任务栏关闭window绑定窗体的FormClosing事件,执行e.Cancel = True即可 。
如果你不想在任务栏上显示窗体,把窗体的ShowOnTaskbar设为False 。
VB.NET 2005 点击按钮后,窗口退出了?你把该过程内的代码复制到别的地方先保存 。然后把这个单击过程删除 。重新点击按钮 进入事件,粘贴刚才的代码
vb.net中 如何将窗体上的关闭按钮禁用 也就是变灰?。?/h2>FormBorderStyle选为Nonevb.net禁止退出,没有标题栏
formvb.net禁止退出的controlbox属性为false
vb.net如何彻底退出进程?主窗体代码调用Me.close不就可以vb.net禁止退出了吗?或者在任意代码处调用Application.Exit() 。如果不起作用vb.net禁止退出的话是因为vb.net禁止退出你在窗体关闭的事件中调用vb.net禁止退出了e.Handle=True
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
推荐阅读
- 公众号文章发出怎么修改,公众号发表文章如何修改
- 关闭linux系统命令,linux关闭ssh连接
- 大班体育游戏趣味抢球,大班体育游戏趣味抢球反思
- vb.net填充表单 vb在form上添加菜单
- 包含sapmovement的词条
- python对象函数 python函数对象的属性和方法
- redis队列元素个数命令,redis设置队列长度
- 文件导入u盘过大怎么办,倒入u盘文件过大
- 怎么修改显卡散热声音,如何给显卡散热降温