vb6,自身隐藏
发布网友
发布时间:2024-10-10 14:00
我来回答
共2个回答
热心网友
时间:2024-11-19 19:30
App.TaskVisible = False'这一句代码是将程序在任务管理器中隐藏
BM666 的组合键热键设置】2007年12月27日 星期四 19:34'******************* .Bas 模块里面的代码
Option Explicit
Public Declare Function RegisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long
Public Declare Function UnregisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const MOD_ALT = &H1
Public Const MOD_CONTROL = &H2
Public Const MOD_SHIFT = &H4
Public Const WM_HOTKEY = &H312
Public Const GWL_WNDPROC = (-4)
Public p&
Public Function wnd(ByVal hWnd As Long, ByVal Msg As Long, ByVal wp As Long, ByVal lp As Long) As Long
If Msg = WM_HOTKEY Then
If wp = &HB000 Then
'在这里你想干什么就写什么代码
MsgBox "你按了 Ctrl + Alt + V 键"
ElseIf wp = &HB001 Then
MsgBox "你按了 Ctrl + Alt + B 键"
End If
End If
wnd = CallWindowProc(p, hWnd, Msg, wp, lp)
End Function
'******************* Form1 里面的代码
Option Explicit
Private Sub Form_Load()
RegisterHotKey Me.hWnd, &HB000, MOD_CONTROL + MOD_ALT, vbKeyV '定义 Ctrl + Alt + V 为热键
RegisterHotKey Me.hWnd, &HB001, MOD_CONTROL + MOD_ALT, vbKeyB '定义 Ctrl + Alt + B 为热键
p = SetWindowLong(Me.hWnd, GWL_WNDPROC, AddressOf wnd)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call UnregisterHotKey(Me.hWnd, &HB000&) '撤销热键的注册Ctrl + Alt + V
Call UnregisterHotKey(Me.hWnd, &HB001&) '撤销热键的注册Ctrl + Alt + B
SetWindowLong Me.hWnd, GWL_WNDPROC, p
End Sub
热心网友
时间:2024-11-19 19:31
给出VB6中如何能使程序有热键功能的资料或代码,另加10分
好慷慨啊~~~