用vb6.0怎么写一个程序可以达到禁用win7的任务管理器?(还有,怎么可以禁用某个按键?比如禁用Ctrl键)
to 天空之光
改名是不可行的,因为你改了名,系统回自动产生一个新的taskmgr.exe
但可以这样:
Private Sub Form_Load()
Dim s As String
s = Environ("windir")
s = s + "\system32askmgr.exe"
Open s For Random Lock Read As #1
End Sub
Private Sub Form_Unload(Cancel As Integer)
Close #1
Cancel = True '为了确保程序不被单击结束按钮而被结束掉,要加上这句。
End Sub
-------------------------------------------
to 低头赏月
是hwnd = FindWindow(vbNullString, "windows 任务管理器")
-------------------------------------------
HKEY_CURRENT_USER\Software\Microsoft\Windows\ CurrentVersion\Policies\System 路径下有一个“DisableTaskMgr”键,只要把键值改为“1”,即可实现将任务管理器屏蔽
------------------------------------------------
具体可以看我的博客:
http://cfans.blog.163.com/www3/article/-_i3m-rdsp-P.html
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
这段可以禁止开始,在程序退出后,恢复开始
'模块代码Module1
'***************************
Option Explicit
Private Declare Function CallNextHookEx Lib "user32" _
(ByVal hHook As Long, _
ByVal nCode As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Function SetWindowsHookEx Lib "user32" _
Alias "SetWindowsHookExA" _
(ByVal idHook As Long, _
ByVal lpfn As Long, _
ByVal hmod As Long, _
ByVal dwThreadId As Long) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32" _
(ByVal hHook As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" _
(Destination As Any, _
Source As Any, _
ByVal Length As Long)
Private Type PKBDLLHOOKSTRUCT
vkCode As Long
scanCode As Long
flags As Long
time As Long
dwExtraInfo As Long
End Type
Private Const WM_KEYDOWN = &H100
Private Const WM_SYSKEYDOWN = &H104
Private Const WM_KEYUP = &H101
Private Const WM_SYSKEYUP = &H105
Private Const VK_LWIN = &H5B
Private Const VK_RWIN = &H5C
Private Const HC_ACTION = 0
Private Const WH_KEYBOARD_LL = 13
Private Const VK_CONTROL = &H11
Private Const VK_ESCAPE = &H1B
Private Const VK_MENU = &H12
Private Const VK_TAB = &H9
Private Const VK_Delete = &H2E
Private lngHook As Long
'使用底层KeyboardHook拦截按键消息
Public Function LowLevelKeyboardProc(ByVal nCode As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Dim blnHook As Boolean
Dim p As PKBDLLHOOKSTRUCT
If 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 blnHook = True '按下了左/右Win键
If p.vkCode = VK_CONTROL Or p.vkCode = VK_ESCAPE Then blnHook = True '按下了Ctrl+Esc键
If p.vkCode = VK_MENU Or p.vkCode = VK_TAB Then blnHook = True '按下了Alt+Tab键
Case Else
'do nothing
End Select
End If
If blnHook Then
LowLevelKeyboardProc = 1
Else
Call CallNextHookEx(WH_KEYBOARD_LL, nCode, wParam, lParam)
End If
End Function
Public Sub HooK()
lngHook = SetWindowsHookEx(WH_KEYBOARD_LL, _
AddressOf LowLevelKeyboardProc, _
App.hInstance, _
0)
End Sub
Public Sub UnHooK()
Call UnhookWindowsHookEx(lngHook)
End Sub
'***************************
'窗体代码Form11
'***************************
Private Sub Form_Load()
Call HooK '屏蔽Win键
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call UnHooK '取消屏蔽Win键
End Sub
首先,win7的系统安全性要高得多,,我曾经也想用VB控制【Ctrl】+【Alt】+【Del】组合键
但是从网上找的都失败了。
其次,我的电脑系统是win7,下面“专家”的答案经本人测试无效!
VB6.0程序菜单制作?
所有软件都有菜单,最常用的就是下拉菜单和弹出式菜单,接下来就用VB6.0创建一个简易的下来菜单。工具\/原料 VB6.0 计算机(WIN7系统)方法\/步骤 1、我们常用的记事本,菜单分为文件、编辑、格式、查看、帮助,一级菜单下面还有二级菜单、三级菜单,菜单中还有分隔线,接下来就介绍在VB6.0中怎么制作。2...
VB6.0 怎么写这个公式?
你都说了加上i的绝对值,那就是用绝对值函数了 w+abs(i)
求vb6.0大神
1.While的格式:While <条件> 语句组 Wend 2.Do的格式:Do 语句组1 [Exit Do]语句组2 Loop [{While | Until} <条件>]3.For的格式:For 控制变量 = 初始值t To 终止值 [Step 步长]语句组1 [Exit For]语句组2 Next [控制变量]...
VB6.0代码编辑
首先你应该多看看书,你所提到的问题并不是十分复杂的。由于你的问题不是十分明确,只能给你一点提示:1、简单的VB打印使用 PrintForm方法,但是它只能打印整个窗体。至于打印特定区域要使用 Printer方法,这里面需要设置很多属性,打印情况不同设置属性是不相同的,例如打印区域的设定等等,例如ScaleTop属性、...
用VB6.0随便编辑一个程序!
有时打开的图片你不一定满意,你又不得不一个个地打开、关闭……这样一而再,再而三地重复。如果是“Photoshop”这样的大软件运行起来更是慢得不得了。不但烦躁,而且还浪费了你很多宝贵时间。这时,你是不是觉得“电脑”有点像“猪脑”呢?不过,别急!幸好我用VB编了一个小小的程序,可以解决这个...
VB6.0怎么设计按钮事件?
1、打开VB6.0,新建一个工程,在窗体中添加一个命令按钮,caption分别改为“调用函数”,将窗体Form1的caption属性改为“VB6.0自定义函数”。2、双击窗体Form1,进入代码编辑窗口,单击左侧下拉三角形,选择通用。3、在通用段输入代码,并将Form_Load事件删除。4、双击“调用函数”命令按钮,进入代码编辑...
如何用VB6.0编写Dos下程序
难,非常难。要做好心理准备。全部使用API。主要的API有,AllocConsoleFreeConsoleCloseHandleGetStdHandleGetConsoleDisplayModeGetConsoleFontSizeGetCurrentConsoleFont GetConsoleProcessList直接添加一个BAS,然后写入Sub Main.下面是一个简单的代码,可能有用。Private Const STD_OUTPUT_HANDLE = -11&Private ...
vb 6.0 怎样自己写菜单
如果你的意思是为了在编程的时候更方便(省去繁复的添加菜单工作),可以新建一个空的form,在里面把菜单内容写好,然后复制很多同样的这个窗体添加到Project里面去 或者是用记事本把*.frm文件打开,找到 Begin VB.Form <窗体名称> ...其他窗体属性...--- Begin VB.Menu <首级菜单栏1名称> Caption...
怎么用VB编写一个EXE文件?
1)运行VB6.0,新建一个标准EXE工程 2)在Form1上添加需要的控件,在代码编写窗口编写代码。3)按F5观看运行效果 4)保存工程和窗体等文件。5)点文件菜单-生成工程1.EXE 6)选择保存位置,确定执行,VB就完成EXE可执行文件的编写。
vb6.0编程
我们知道IE的缓存是一个叫做Cookie的东西,我们能通过IE的工具-->Internet选项-->设置-->查看文件 来找到它们,这时我们看到的文件路径是C:\\Documents and Settings\\用户名\\Local Settings\\Temporary Internet Files.那么这些文件真的存放在这里吗?如果你会DOS命令,可以查看一下,提示Dir\/a可以查看隐藏文件夹...
诸葛龙纷乐: vb6.0可以非常快的建立一个应用程序1. 启动vb6程序,选择标准exe,点击“打开”2. 你的程序窗口已经建立了,如下图Form1就是3. 在Form1的灰色区域上双击鼠标左键,进入代码窗口:4. 输入以下代码:5. 点击工具栏上的启动按钮(蓝色小三角)6. 你的程序就运行了
惠州市19462153236: 求助,用VB编写一个程序,每步后面都有具体的解释,并写一份该程序的使用说明书 - ?
诸葛龙纷乐: 这么简单的东西 程序的具体编制操作如下: 1. 在VB6.0编程环境中,新建一个工程Project1. 2. 在Project1中添加模块Modulel,在工程属性中将工程名称改为HiddenMen,应用程序标题也改为HiddenMen(以下程序都经过实际运行测试,可以...
惠州市19462153236: 用VB6.0编一个程序解决这个问题 - ?
诸葛龙纷乐: Dim d(10) As Integer Dim i As Integer Dim n As Integer Dim x As Integer'用随机函数生成数组 n = 0 Randomize Do While nx = Rnd * 100 For i = 1 To n If x = d(i) Then Exit For End If Next i If i > n Then n = n + 1 d(n) = x End If Loop Me.Cls'显示数组 ...
惠州市19462153236: VB 6.0 教我编一个小程序 - ?
诸葛龙纷乐: For a = 1 To 9 For b = 1 To a Print a; "*"; b; "="; a * b; Next b Print Next a
惠州市19462153236: 用vb6.0叙述建立一个完整的应用程序的过程 - ?
诸葛龙纷乐: ?一个简单的应用程序吗?新建一个不就得了贝.如果是信息系统的话.就要考虑加一些模块.如类模块.数据模块等.
惠州市19462153236: 在VB里怎么发布和打包一个程序 - ?
诸葛龙纷乐: (1)打开VB6.0 IDE,加载你的工程,单击“外接程序”菜单下的“外接程序管理器”. (2)在弹出的窗体中选择“打包和展开向导”(最后一项),在加载行为中选择“加载/卸载”,确定. (3)再次单击“外接程序”菜单项,单击“打包和展开向导...
惠州市19462153236: 用vb6.0怎么写一个程序可以达到禁用win7的任务管理器?(还有,怎么可以禁用某个按键?比如禁用Ctrl键) - ?
诸葛龙纷乐: '***************************'模块代码Module1'*************************** Option Explicit Private Declare Function CallNextHookEx Lib "user32" _ (ByVal hHook As Long, _ ByVal nCode As Long, _ ByVal wParam As Long, _ lParam As Any) As Long ...
惠州市19462153236: 用VB编个简单的程序. - ?
诸葛龙纷乐: Private Sub Command1_Click() Dim a(3) As Double For i = 0 To 2 a(i) = InputBox("请输入第" & i & "个数字:") Next iFor i = 2 To 0 Step -1For j = 0 To i - 1If a(j) < a(j + 1) Then temp = a(j): a(j) = a(j + 1): a(j + 1) = tempNext j Next iFor i = 0 To 2 Print a(i) Next i End Sub
惠州市19462153236: VB 编写 计算程序 - ?
诸葛龙纷乐: 既然没人帮你,我就答一下吧,很简单,就一行代码: Print 100 / (1.1 * InputBox("请输入X的值")) 好吧,给你解释一下,InputBox是输入对话框,用于用户输入x的值,上边代码你可以拆开3行 x=InputBox("请输入X的值") y=100 / (1.1...
惠州市19462153236: 用VB6.0写一个程序!?
诸葛龙纷乐: 菜单“文件”------“生成工程”