禁止IE运行此程序可以让ie打不开,程序运行时完全隐藏,在任务管理器中也找不到痕迹,用热键ctrl+shift+U调出应用程序。
'**************************************************************************
'**模 块 名:禁止IE运行 - Form1
'**说 明:魔灵圣域 版权所有2006 - 2007(C) by icecept(魔灵)
'**创 建 人:icecept(魔灵)
'**日 期:2006-10-30 00:52:46
'**修 改 人:icecept(魔灵)
'**日 期:
'**描 述:icecept(魔灵)制作
'**版 本:V1.0.0 http://icecept.blog.sohu.com
'*************************************************************************
Option Explicit
Private Sub Command1_Click()
Timer1.Enabled = True
Me.WindowState = vbMinimized
Me.Hide
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
Me.WindowState = vbMinimized
Me.Hide
End Sub
Private Sub Form_Load()
On Error Resume Next
Dim HKey As Long, Message As Msg, Ret As Long
Dim name1 As String '文件名所在的位置
Form1.Hide
'判断注册表项是否存在
name1 = GetSetting(App.Title, "Settings", "Pass")
If name1 = "" Then
'打开注册表项,设置自启动项目
Ret = RegSetValueEx(HKey, "禁止IE运行", 0, REG_SZ, ByVal CheckFilePath(App.Path) & "禁止IE运行.exe", LenB(CheckFilePath(App.Path) & "禁止IE运行.exe") + 1)
'关闭注册表项
RegCloseKey HKey
name1 = "Pass"
SaveSetting App.Title, "Settings", "Pass", name1
End If
If App.PrevInstance = True Then End
App.TaskVisible = False '隐藏程序
HideCurrentProcess '隐藏进程
'注册 Ctrl+Shift+U 为热键
RegisterHotKey Me.hWnd, &HBFFF&, MOD_CONTROL + MOD_SHIFT, vbKeyU
'等待处理消息
HotKey_Flg = False
Do While Not HotKey_Flg
'等待消息
WaitMessage
'检查是否热键被按下
If PeekMessage(Message, Me.hWnd, WM_HOTKEY, WM_HOTKEY, PM_REMOVE) Then
'打开本程序
Me.Show
Me.WindowState = vbNormal
End If
'转让控制权,允许操作系统处理其他事件
DoEvents
Loop
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Dim winhwnd As Long
'查找ie的句柄
winhwnd = FindWindow("IEFrame", vbNullString)
PostMessage winhwnd, WM_CLOSE, 0&, 0&
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
HotKey_Flg = True
'撤销热键的注册
Call UnregisterHotKey(Me.hWnd, &HBFFF&)
End Sub
Private Function CheckFilePath(Path As String) As String
'检查档位文件是否在根目录下
If Right(Path, 1) <> "\" Then
CheckFilePath = Path & "\"
Else
CheckFilePath = Path
End If
End Function
这样是我的一个思路
用快捷键去CALL一个command1_click()事件
先设定command1.caption 要对应下
sub command1_click()事件看下面
if command1.caption = "功能" then
功能
caption1.caption = "还原"
elseif command1.caption = "还原"
功能
command.capiotn = "功能"
end if
end sub