想知道以下3个Api函数的详细解释:
1.SetWindowsHookEx
2.UnhookWindowsHookEx
3.CallNextHookEx
(不用费劲去Msdn找了,Api参考手册居然都没有,晕)
第二个问题(还是我提问过多次的那个老问题):
我想在资源管理器窗口上 再加上一个Toolbar,(我看到过有些软件做到了,而且添加的Toolbar中还有启动程序的按钮,比如 金山独霸),请问在注册表中的那里更改可以做到?
是不是还有朋友不明白我的意思?就是这样的:
在 资源管理器(或者我的电脑) 工具条上按鼠标键,出来菜单选择“链接”,你看,是不是多了一个Toolbar出来?我想自己添加一个类似于"链接"的Toolbar到资源管理器上的工具条,我想应该是在注册表中修改或添加某个键值来做到的.
当然,不一定要添加Toolbar,添加一个按纽也可以,不过我想不太可能.呵呵.
还有,不是对IE来操作,是对资源管理器(或者我的电脑)的操作!(有朋友总是告诉我在IE上添加按纽,不是我想要的.)
请赐教,回答出来或提供思路200分相送!UP也有份!!
最新消息:现在我已经知道了注册表中这个地方
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar
下增加一些键值能够达到效果,(就是会在鼠标右键菜单中出来Toolbar的自定义过的选单),可是现在我并不会自己增加键值,请教高人!
77 个解决方案
#1
IE右键菜单:
HKEY_USERS\.DEFAULT\Software\Microsoft\Internet Explorer\MenuExt\自定义菜单名字
(默认)=“C:\PROGRAM FILES\自定义菜单名字\自定义菜单名字.htm”
IE工具栏按钮:
参考一下以下的位置
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Extensions
其实不管是资源管理器还是IE,里面的“链接”还是“工具栏”都是调用注册表中的某一位置
要不微软为什么把IE捆绑在Windows中一起销售呢?
有时间的话,参考并且斧正一下我的程序,谢谢在先!
http://www.wjez.net/wchsoft/ipage2.htm
(严防死守)你需要的问题在:“IE设置”----“下一步”
HKEY_USERS\.DEFAULT\Software\Microsoft\Internet Explorer\MenuExt\自定义菜单名字
(默认)=“C:\PROGRAM FILES\自定义菜单名字\自定义菜单名字.htm”
IE工具栏按钮:
参考一下以下的位置
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Extensions
其实不管是资源管理器还是IE,里面的“链接”还是“工具栏”都是调用注册表中的某一位置
要不微软为什么把IE捆绑在Windows中一起销售呢?
有时间的话,参考并且斧正一下我的程序,谢谢在先!
http://www.wjez.net/wchsoft/ipage2.htm
(严防死守)你需要的问题在:“IE设置”----“下一步”
#2
1.SetWindowsHookEx
【VB声明】
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
【别名】
SetWindowsHookExA
实例
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
【VB声明】
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
【别名】
SetWindowsHookExA
实例
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
#3
1.SetWindowsHookEx
【VB声明】
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
【别名】
SetWindowsHookExA
实例
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
【VB声明】
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
【别名】
SetWindowsHookExA
实例
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
#4
2.UnhookWindowsHookEx
【VB声明】
Private Declare Function UnhookWindowsHookEx Lib "user32" Alias "UnhookWindowsHookEx" (ByVal hHook As Long) As Long
实例:
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
3.CallNextHookEx
【VB声明】
Private Declare Function CallNextHookEx Lib "user32" Alias "CallNextHookEx" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
实例:
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
【VB声明】
Private Declare Function UnhookWindowsHookEx Lib "user32" Alias "UnhookWindowsHookEx" (ByVal hHook As Long) As Long
实例:
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
3.CallNextHookEx
【VB声明】
Private Declare Function CallNextHookEx Lib "user32" Alias "CallNextHookEx" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
实例:
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
#5
up
#6
SetWindowsHookEx,UnhookWindowsHookEx,CallNextHookEx谁说在MSDN中没有说明的?这三个函数和钩子函数有关,SetWindowsHookEx用于设置一个钩子函数,UnhookWindowsHookEx用于卸载一个钩子函数,CallNextHookEx调用钩子函数链中的下一个钩子函数。
SetWindowsHookEx Function
--------------------------------------------------------------------------------
The SetWindowsHookEx function installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor the system for certain types of events. These events are associated either with a specific thread or with all threads in the same desktop as the calling thread.
Syntax
HHOOK SetWindowsHookEx( int idHook,
HOOKPROC lpfn,
HINSTANCE hMod,
DWORD dwThreadId
);
Parameters
idHook
[in] Specifies the type of hook procedure to be installed. This parameter can be one of the following values.
WH_CALLWNDPROC
Installs a hook procedure that monitors messages before the system sends them to the destination window procedure. For more information, see the CallWndProc hook procedure.
WH_CALLWNDPROCRET
Installs a hook procedure that monitors messages after they have been processed by the destination window procedure. For more information, see the CallWndRetProc hook procedure.
WH_CBT
Installs a hook procedure that receives notifications useful to a computer-based training (CBT) application. For more information, see the CBTProc hook procedure.
WH_DEBUG
Installs a hook procedure useful for debugging other hook procedures. For more information, see the DebugProc hook procedure.
WH_FOREGROUNDIDLE
Installs a hook procedure that will be called when the application's foreground thread is about to become idle. This hook is useful for performing low priority tasks during idle time. For more information, see the ForegroundIdleProc hook procedure.
WH_GETMESSAGE
Installs a hook procedure that monitors messages posted to a message queue. For more information, see the GetMsgProc hook procedure.
WH_JOURNALPLAYBACK
Installs a hook procedure that posts messages previously recorded by a WH_JOURNALRECORD hook procedure. For more information, see the JournalPlaybackProc hook procedure.
WH_JOURNALRECORD
Installs a hook procedure that records input messages posted to the system message queue. This hook is useful for recording macros. For more information, see the JournalRecordProc hook procedure.
WH_KEYBOARD
Installs a hook procedure that monitors keystroke messages. For more information, see the KeyboardProc hook procedure.
WH_KEYBOARD_LL
Windows NT/2000/XP: Installs a hook procedure that monitors low-level keyboard input events. For more information, see the LowLevelKeyboardProc hook procedure.
WH_MOUSE
Installs a hook procedure that monitors mouse messages. For more information, see the MouseProc hook procedure.
WH_MOUSE_LL
Windows NT/2000/XP: Installs a hook procedure that monitors low-level mouse input events. For more information, see the LowLevelMouseProc hook procedure.
WH_MSGFILTER
Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. For more information, see the MessageProc hook procedure.
WH_SHELL
Installs a hook procedure that receives notifications useful to shell applications. For more information, see the ShellProc hook procedure.
WH_SYSMSGFILTER
Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. The hook procedure monitors these messages for all applications in the same desktop as the calling thread. For more information, see the SysMsgProc hook procedure.
lpfn
[in] Pointer to the hook procedure. If the dwThreadId parameter is zero or specifies the identifier of a thread created by a different process, the lpfn parameter must point to a hook procedure in a dynamic-link library (DLL). Otherwise, lpfn can point to a hook procedure in the code associated with the current process.
hMod
[in] Handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process.
dwThreadId
[in] Specifies the identifier of the thread with which the hook procedure is to be associated. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread.
Return Value
If the function succeeds, the return value is the handle to the hook procedure.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
An error may occur if the hMod parameter is NULL and the dwThreadId parameter is zero or specifies the identifier of a thread created by another process.
Calling the CallNextHookEx function to chain to the next hook procedure is optional, but it is highly recommended; otherwise, other applications that have installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.
Before terminating, an application must call the UnhookWindowsHookEx function to free system resources associated with the hook.
The scope of a hook depends on the hook type. Some hooks can be set only with global scope; others can also be set for only a specific thread, as shown in the following table.
Hook Scope
WH_CALLWNDPROC Thread or global
WH_CALLWNDPROCRET Thread or global
WH_CBT Thread or global
WH_DEBUG Thread or global
WH_FOREGROUNDIDLE Thread or global
WH_GETMESSAGE Thread or global
WH_JOURNALPLAYBACK Global only
WH_JOURNALRECORD Global only
WH_KEYBOARD Thread or global
WH_KEYBOARD_LL Global only
WH_MOUSE Thread or global
WH_MOUSE_LL Global only
WH_MSGFILTER Thread or global
WH_SHELL Thread or global
WH_SYSMSGFILTER Global only
For a specified hook type, thread hooks are called first, then global hooks.
The global hooks are a shared resource, and installing one affects all applications in the same desktop as the calling thread. All global hook functions must be in libraries. Global hooks should be restricted to special-purpose applications or to use as a development aid during application debugging. Libraries that no longer need a hook should remove its hook procedure.
Windows 95/98/Me: SetWindowsHookEx is supported by the Microsoft® Layer for Unicode (MSLU). However, it does not make conversions. To see Unicode messages, notifications, and so forth, you must subclass the window. To use this version of the application programming interface (API), you must add certain files to your application, as outlined in Installing and Releasing Hook Procedures
SetWindowsHookEx Function
--------------------------------------------------------------------------------
The SetWindowsHookEx function installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor the system for certain types of events. These events are associated either with a specific thread or with all threads in the same desktop as the calling thread.
Syntax
HHOOK SetWindowsHookEx( int idHook,
HOOKPROC lpfn,
HINSTANCE hMod,
DWORD dwThreadId
);
Parameters
idHook
[in] Specifies the type of hook procedure to be installed. This parameter can be one of the following values.
WH_CALLWNDPROC
Installs a hook procedure that monitors messages before the system sends them to the destination window procedure. For more information, see the CallWndProc hook procedure.
WH_CALLWNDPROCRET
Installs a hook procedure that monitors messages after they have been processed by the destination window procedure. For more information, see the CallWndRetProc hook procedure.
WH_CBT
Installs a hook procedure that receives notifications useful to a computer-based training (CBT) application. For more information, see the CBTProc hook procedure.
WH_DEBUG
Installs a hook procedure useful for debugging other hook procedures. For more information, see the DebugProc hook procedure.
WH_FOREGROUNDIDLE
Installs a hook procedure that will be called when the application's foreground thread is about to become idle. This hook is useful for performing low priority tasks during idle time. For more information, see the ForegroundIdleProc hook procedure.
WH_GETMESSAGE
Installs a hook procedure that monitors messages posted to a message queue. For more information, see the GetMsgProc hook procedure.
WH_JOURNALPLAYBACK
Installs a hook procedure that posts messages previously recorded by a WH_JOURNALRECORD hook procedure. For more information, see the JournalPlaybackProc hook procedure.
WH_JOURNALRECORD
Installs a hook procedure that records input messages posted to the system message queue. This hook is useful for recording macros. For more information, see the JournalRecordProc hook procedure.
WH_KEYBOARD
Installs a hook procedure that monitors keystroke messages. For more information, see the KeyboardProc hook procedure.
WH_KEYBOARD_LL
Windows NT/2000/XP: Installs a hook procedure that monitors low-level keyboard input events. For more information, see the LowLevelKeyboardProc hook procedure.
WH_MOUSE
Installs a hook procedure that monitors mouse messages. For more information, see the MouseProc hook procedure.
WH_MOUSE_LL
Windows NT/2000/XP: Installs a hook procedure that monitors low-level mouse input events. For more information, see the LowLevelMouseProc hook procedure.
WH_MSGFILTER
Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. For more information, see the MessageProc hook procedure.
WH_SHELL
Installs a hook procedure that receives notifications useful to shell applications. For more information, see the ShellProc hook procedure.
WH_SYSMSGFILTER
Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. The hook procedure monitors these messages for all applications in the same desktop as the calling thread. For more information, see the SysMsgProc hook procedure.
lpfn
[in] Pointer to the hook procedure. If the dwThreadId parameter is zero or specifies the identifier of a thread created by a different process, the lpfn parameter must point to a hook procedure in a dynamic-link library (DLL). Otherwise, lpfn can point to a hook procedure in the code associated with the current process.
hMod
[in] Handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process.
dwThreadId
[in] Specifies the identifier of the thread with which the hook procedure is to be associated. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread.
Return Value
If the function succeeds, the return value is the handle to the hook procedure.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
An error may occur if the hMod parameter is NULL and the dwThreadId parameter is zero or specifies the identifier of a thread created by another process.
Calling the CallNextHookEx function to chain to the next hook procedure is optional, but it is highly recommended; otherwise, other applications that have installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.
Before terminating, an application must call the UnhookWindowsHookEx function to free system resources associated with the hook.
The scope of a hook depends on the hook type. Some hooks can be set only with global scope; others can also be set for only a specific thread, as shown in the following table.
Hook Scope
WH_CALLWNDPROC Thread or global
WH_CALLWNDPROCRET Thread or global
WH_CBT Thread or global
WH_DEBUG Thread or global
WH_FOREGROUNDIDLE Thread or global
WH_GETMESSAGE Thread or global
WH_JOURNALPLAYBACK Global only
WH_JOURNALRECORD Global only
WH_KEYBOARD Thread or global
WH_KEYBOARD_LL Global only
WH_MOUSE Thread or global
WH_MOUSE_LL Global only
WH_MSGFILTER Thread or global
WH_SHELL Thread or global
WH_SYSMSGFILTER Global only
For a specified hook type, thread hooks are called first, then global hooks.
The global hooks are a shared resource, and installing one affects all applications in the same desktop as the calling thread. All global hook functions must be in libraries. Global hooks should be restricted to special-purpose applications or to use as a development aid during application debugging. Libraries that no longer need a hook should remove its hook procedure.
Windows 95/98/Me: SetWindowsHookEx is supported by the Microsoft® Layer for Unicode (MSLU). However, it does not make conversions. To see Unicode messages, notifications, and so forth, you must subclass the window. To use this version of the application programming interface (API), you must add certain files to your application, as outlined in Installing and Releasing Hook Procedures
#7
UnhookWindowsHookEx Function
--------------------------------------------------------------------------------
The UnhookWindowsHookEx function removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.
Syntax
BOOL UnhookWindowsHookEx( HHOOK hhk
);
Parameters
hhk
[in] Handle to the hook to be removed. This parameter is a hook handle obtained by a previous call to SetWindowsHookEx.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
The hook procedure can be in the state of being called by another thread even after UnhookWindowsHookEx returns. If the hook procedure is not being called concurrently, the hook procedure is removed immediately before UnhookWindowsHookEx returns.
--------------------------------------------------------------------------------
The UnhookWindowsHookEx function removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.
Syntax
BOOL UnhookWindowsHookEx( HHOOK hhk
);
Parameters
hhk
[in] Handle to the hook to be removed. This parameter is a hook handle obtained by a previous call to SetWindowsHookEx.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
The hook procedure can be in the state of being called by another thread even after UnhookWindowsHookEx returns. If the hook procedure is not being called concurrently, the hook procedure is removed immediately before UnhookWindowsHookEx returns.
#8
CallNextHookEx Function
--------------------------------------------------------------------------------
The CallNextHookEx function passes the hook information to the next hook procedure in the current hook chain. A hook procedure can call this function either before or after processing the hook information.
Syntax
LRESULT CallNextHookEx( HHOOK hhk,
int nCode,
WPARAM wParam,
LPARAM lParam
);
Parameters
hhk
[in] Handle to the current hook. An application receives this handle as a result of a previous call to the SetWindowsHookEx function.
nCode
[in] Specifies the hook code passed to the current hook procedure. The next hook procedure uses this code to determine how to process the hook information.
wParam
[in] Specifies the wParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain.
lParam
[in] Specifies the lParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain.
Return Value
This value is returned by the next hook procedure in the chain. The current hook procedure must also return this value. The meaning of the return value depends on the hook type. For more information, see the descriptions of the individual hook procedures.
Remarks
Hook procedures are installed in chains for particular hook types. CallNextHookEx calls the next hook in the chain.
Calling CallNextHookEx is optional, but it is highly recommended; otherwise, other applications that have installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.
--------------------------------------------------------------------------------
The CallNextHookEx function passes the hook information to the next hook procedure in the current hook chain. A hook procedure can call this function either before or after processing the hook information.
Syntax
LRESULT CallNextHookEx( HHOOK hhk,
int nCode,
WPARAM wParam,
LPARAM lParam
);
Parameters
hhk
[in] Handle to the current hook. An application receives this handle as a result of a previous call to the SetWindowsHookEx function.
nCode
[in] Specifies the hook code passed to the current hook procedure. The next hook procedure uses this code to determine how to process the hook information.
wParam
[in] Specifies the wParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain.
lParam
[in] Specifies the lParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain.
Return Value
This value is returned by the next hook procedure in the chain. The current hook procedure must also return this value. The meaning of the return value depends on the hook type. For more information, see the descriptions of the individual hook procedures.
Remarks
Hook procedures are installed in chains for particular hook types. CallNextHookEx calls the next hook in the chain.
Calling CallNextHookEx is optional, but it is highly recommended; otherwise, other applications that have installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.
#9
yunok (★ 杨云鹏,用VB,向高手们学习! ★):你的第二个问题,是嵌入式软件使用的方法,请版主来回答吧。也许VB难以实现(用C)
#10
=========================================================================
其实不管是资源管理器还是IE,里面的“链接”还是“工具栏”都是调用注册表中的某一位置
要不微软为什么把IE捆绑在Windows中一起销售呢?
=========================================================================
To: wchsoft(无名工作室) 兄:
IE和资源管理器里面的“链接”,"地址栏”,的确是调用同一地址的,但是和第三方应用程序加入的快捷栏却是不同的. 如果您不相信,请您亲自试一试,我试试验了多次实在没有办法才来麻烦大家的. 还有,微软把IE捆绑在Windows中一起销售,一是为了打跨其他浏览器,比如网景等等,而是为了迅速扩大垄断地位. 这个我的题目要求有什么关系??我不明白.
其实不管是资源管理器还是IE,里面的“链接”还是“工具栏”都是调用注册表中的某一位置
要不微软为什么把IE捆绑在Windows中一起销售呢?
=========================================================================
To: wchsoft(无名工作室) 兄:
IE和资源管理器里面的“链接”,"地址栏”,的确是调用同一地址的,但是和第三方应用程序加入的快捷栏却是不同的. 如果您不相信,请您亲自试一试,我试试验了多次实在没有办法才来麻烦大家的. 还有,微软把IE捆绑在Windows中一起销售,一是为了打跨其他浏览器,比如网景等等,而是为了迅速扩大垄断地位. 这个我的题目要求有什么关系??我不明白.
#11
To: qingming81(晴明) gcj123(佛的光辉)
我想知道3个Api函数各个参数的详细意义呀.这些例子在Snow_Win32Api中我也找到但过得. :( 当然,看完这些例子也很有帮助的. 谢谢你们!
我想知道3个Api函数各个参数的详细意义呀.这些例子在Snow_Win32Api中我也找到但过得. :( 当然,看完这些例子也很有帮助的. 谢谢你们!
#12
不知道你是否装了聊天软件“雅虎通”,建议你装一装,在装之前把注册表导出,装之后再导出,然后通过FC比较到一个文本文件中,看看该文本文件,我相信你会有很大的收获的。
#13
===========================================================================
yunok (★ 杨云鹏,用VB,向高手们学习! ★):你的第二个问题,是嵌入式软件使用的方法,请版主来回答吧。也许VB难以实现(用C)
===========================================================================
To: qingming81(晴明) :
通过注册表可以解决的,我已经可以做到在资源管理器工具栏处点击鼠标右键出来"凝尘软件"字样的菜单了(就是跟在"链接"下面多出来的.呵呵),只是现在还不知道如何出来一个Toolbar,并且上边有我的应用程序. :(
yunok (★ 杨云鹏,用VB,向高手们学习! ★):你的第二个问题,是嵌入式软件使用的方法,请版主来回答吧。也许VB难以实现(用C)
===========================================================================
To: qingming81(晴明) :
通过注册表可以解决的,我已经可以做到在资源管理器工具栏处点击鼠标右键出来"凝尘软件"字样的菜单了(就是跟在"链接"下面多出来的.呵呵),只是现在还不知道如何出来一个Toolbar,并且上边有我的应用程序. :(
#14
==========================================================================
不知道你是否装了聊天软件“雅虎通”,建议你装一装,在装之前把注册表导出,装之后再导出,然后通过FC比较到一个文本文件中,看看该文本文件,我相信你会有很大的收获的。
==========================================================================
To: wchsoft(无名工作室)
我装过瑞星,诺顿,3721上网助手,雅虎通,金山独霸等等.我除了用过FC以外,还用过 多种 Reg快照软件来进行对比过. 但是,所有软件的写注册表方法和键值统统是不定的,且无规律可循的. 甚至装2次同样的软件,写注册表的位置都不同. 我晕. 所以才来请教高人的.
不知道你是否装了聊天软件“雅虎通”,建议你装一装,在装之前把注册表导出,装之后再导出,然后通过FC比较到一个文本文件中,看看该文本文件,我相信你会有很大的收获的。
==========================================================================
To: wchsoft(无名工作室)
我装过瑞星,诺顿,3721上网助手,雅虎通,金山独霸等等.我除了用过FC以外,还用过 多种 Reg快照软件来进行对比过. 但是,所有软件的写注册表方法和键值统统是不定的,且无规律可循的. 甚至装2次同样的软件,写注册表的位置都不同. 我晕. 所以才来请教高人的.
#15
To: wchsoft(无名工作室)
您的软件"IE严防死守"我看了, 挺好的.但是功能和效果(甚至可用价值)上还有一些缺陷,请参看我主页上(http://ioi.xiloo.com)的卢培培作品“注册表大师”,我认为是相当好的作品。另外,不才我也有很多对Api操作(类似于超级兔子)的东东,请您下载参看。
请恕在下直言,您的软件在实用率上并没有太大特色,至于能有多少用户使用,请您不妨做个调查试试看。:) 努力!
您的软件"IE严防死守"我看了, 挺好的.但是功能和效果(甚至可用价值)上还有一些缺陷,请参看我主页上(http://ioi.xiloo.com)的卢培培作品“注册表大师”,我认为是相当好的作品。另外,不才我也有很多对Api操作(类似于超级兔子)的东东,请您下载参看。
请恕在下直言,您的软件在实用率上并没有太大特色,至于能有多少用户使用,请您不妨做个调查试试看。:) 努力!
#16
http://www.eaoo.com/design/list.asp?classid=2&Nclassid=12
#17
TO:cnpr(-----)
谢谢您给我的网站,但是没有我需要的答案.
谢谢您给我的网站,但是没有我需要的答案.
#18
搂主啊,我上面的回复已经都说了阿,只不过是英文的,耐心的看吧
#19
工具栏的按钮一般在HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Extensions
不过如果你想在工具栏上添加按钮的话,好象先要在系统中注册一个键值。如:
{ABFC18BB-ED0C-425d-9EF4-42624205BBA4}
至于“雅虎通”,我刚刚接到朋友推荐,对于他为什么在工具栏上写那么多的信息,我还在研究。注意,“雅虎通”是在IE上另外建立一个工具栏区域。
不过如果你想在工具栏上添加按钮的话,好象先要在系统中注册一个键值。如:
{ABFC18BB-ED0C-425d-9EF4-42624205BBA4}
至于“雅虎通”,我刚刚接到朋友推荐,对于他为什么在工具栏上写那么多的信息,我还在研究。注意,“雅虎通”是在IE上另外建立一个工具栏区域。
#20
To: gcj123(佛的光辉)
哦!!!十二分Sorry啊!都怪我粗心啊!看见E文就头大.呵呵.谢谢你啊!api解释我要带回家边翻字典边看了! 呵呵。
哦!!!十二分Sorry啊!都怪我粗心啊!看见E文就头大.呵呵.谢谢你啊!api解释我要带回家边翻字典边看了! 呵呵。
#21
To:wchsoft(无名工作室)
我的题目您可有认真的看呢?我已经说明了:
----------------------------------
还有,不是对IE来操作,是对资源管理器(或者我的电脑)的操作!(有朋友总是告诉我在IE上添加按纽,不是我想要的.)
----------------------------------
再次强调,我不需要再IE上添加按钮,那个十分简单。7行代码即可实现。我需要的是对资源管理器的操作。
谢谢你。
我的题目您可有认真的看呢?我已经说明了:
----------------------------------
还有,不是对IE来操作,是对资源管理器(或者我的电脑)的操作!(有朋友总是告诉我在IE上添加按纽,不是我想要的.)
----------------------------------
再次强调,我不需要再IE上添加按钮,那个十分简单。7行代码即可实现。我需要的是对资源管理器的操作。
谢谢你。
#22
To:yunok(★ 杨云鹏,用VB,向高手们学习! ★)
谢谢你诚恳的语言!至于你推荐的东西,我会去看的。
在软件的实用率上我知道没有多大的使用价值,正是这个原因或许也有其他的原因,我在两个月之前就放弃了VB,不过现在只是无聊,来看看我的CSDN,能帮助人就帮助人,尽自己的能力吧!
谢谢你诚恳的语言!至于你推荐的东西,我会去看的。
在软件的实用率上我知道没有多大的使用价值,正是这个原因或许也有其他的原因,我在两个月之前就放弃了VB,不过现在只是无聊,来看看我的CSDN,能帮助人就帮助人,尽自己的能力吧!
#23
To:wchsoft(无名工作室)
您的网站留言板已经打不开了。是否需要我给您提供一个(就是类似于我主页上的那个)?Asp做的。您可以直接放在我的空间上管理。请参看http://ioi.xiloo.com的链接。
您的网站留言板已经打不开了。是否需要我给您提供一个(就是类似于我主页上的那个)?Asp做的。您可以直接放在我的空间上管理。请参看http://ioi.xiloo.com的链接。
#24
能力有限!抱歉!yunok(★ 杨云鹏,用VB,向高手们学习! ★) 兄。
#25
再To:wchsoft(无名工作室)
微软支持VB到2008年呢!为什么要放弃呢?(当然,大家也已经开始看.net了嘛! :) )虽然Vb入门容易。但是精通确实是困难的。不过各人有个人的想法,希望您一路走好。
微软支持VB到2008年呢!为什么要放弃呢?(当然,大家也已经开始看.net了嘛! :) )虽然Vb入门容易。但是精通确实是困难的。不过各人有个人的想法,希望您一路走好。
#26
看到hook总觉得和钩子有关!
不过我不懂,帮你up!
不过我不懂,帮你up!
#27
我顶!!!!!
顶!!!!!
顶!!!!!
#28
那几个 API 我就不管了,说你说的 IE 按钮和工具栏。
IE 工具栏上的按钮的添加很简单,不一定要编程,改改注册表就可以了
IE 的历史/搜索/媒体等这样的“窗口”叫做 Band,要写 Band 用 VB 存在一定的困难(其实不是不可以,VB也可以实现很多接口),需要写成COM,并注册到 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Explorer Bars,详细的内容回头再说。
简单说说增加菜单和按钮,拿 flashget 做例子:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Extensions\{D6E814A0-E0C5-11d4-8D29-0050BA6940E3}]
"ButtonText"="FlashGet"
"Default Visible"="Yes"
"Exec"="D:\\play\\工具软件\\工具软件\\FLASHGET\\flashget.exe"
"HotIcon"="D:\\play\\工具软件\\工具软件\\FLASHGET\\flashget.exe,128"
"Icon"="D:\\play\\工具软件\\工具软件\\FLASHGET\\flashget.exe,223"
"CLSID"="{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}"
"MenuStatusBar"="FlashGet"
"MenuText"="&FlashGet"
1、在 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Extensions
创建一个新的项,并用 genguid 生成一个 guid 作为名字,例如 flashget 的
{D6E814A0-E0C5-11d4-8D29-0050BA6940E3},你需要换一个不重复的哦
2、添加若干key,如 ButtonText MenuStatusBar 等描述信息
3、添加 Exec 指向你的执行程序
4、为它添加图表文件和激活图表文件 Icon 和 HotIcon
5、一定要创建一个 CLSID,值必须为"{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}",这告诉 IE 它是一个menuitem
6、Flashget 没有这一项,你可以创建string类型的key,名为 MenuCustomize ,值为"help",如果有这个MenuCustomize且为"help",你新增的这一菜单项就跑到“帮助”菜单项下,否则是“工具”菜单项下。
好了,你可以修改 flashget 的注册表试试看效果——别忘记关掉IE,重新打开。
IE 工具栏上的按钮的添加很简单,不一定要编程,改改注册表就可以了
IE 的历史/搜索/媒体等这样的“窗口”叫做 Band,要写 Band 用 VB 存在一定的困难(其实不是不可以,VB也可以实现很多接口),需要写成COM,并注册到 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Explorer Bars,详细的内容回头再说。
简单说说增加菜单和按钮,拿 flashget 做例子:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Extensions\{D6E814A0-E0C5-11d4-8D29-0050BA6940E3}]
"ButtonText"="FlashGet"
"Default Visible"="Yes"
"Exec"="D:\\play\\工具软件\\工具软件\\FLASHGET\\flashget.exe"
"HotIcon"="D:\\play\\工具软件\\工具软件\\FLASHGET\\flashget.exe,128"
"Icon"="D:\\play\\工具软件\\工具软件\\FLASHGET\\flashget.exe,223"
"CLSID"="{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}"
"MenuStatusBar"="FlashGet"
"MenuText"="&FlashGet"
1、在 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Extensions
创建一个新的项,并用 genguid 生成一个 guid 作为名字,例如 flashget 的
{D6E814A0-E0C5-11d4-8D29-0050BA6940E3},你需要换一个不重复的哦
2、添加若干key,如 ButtonText MenuStatusBar 等描述信息
3、添加 Exec 指向你的执行程序
4、为它添加图表文件和激活图表文件 Icon 和 HotIcon
5、一定要创建一个 CLSID,值必须为"{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}",这告诉 IE 它是一个menuitem
6、Flashget 没有这一项,你可以创建string类型的key,名为 MenuCustomize ,值为"help",如果有这个MenuCustomize且为"help",你新增的这一菜单项就跑到“帮助”菜单项下,否则是“工具”菜单项下。
好了,你可以修改 flashget 的注册表试试看效果——别忘记关掉IE,重新打开。
#29
这样你的IE的“工具”或者“帮助”菜单里会多了一项,工具条上也会多了一个按钮。
如果你希望用它调用一个com,而不是exe文件,那么不用创建 "Exec" 项,改为 ClsidExtension,并填写你的COM的 GUID——注意,该COM必需实现了IOleCommandTarget和IObjectWithSite(具体方法查MSDN吧,我不记得了)
如果你不想执行exe,也不想调用com,可以让这个菜单项或按钮调用一个script:用"Script"代替"Exec",并将指向你的javascript/vbscript/windowshostscript的文件的完整路径赋值给它。
如果你希望用它调用一个com,而不是exe文件,那么不用创建 "Exec" 项,改为 ClsidExtension,并填写你的COM的 GUID——注意,该COM必需实现了IOleCommandTarget和IObjectWithSite(具体方法查MSDN吧,我不记得了)
如果你不想执行exe,也不想调用com,可以让这个菜单项或按钮调用一个script:用"Script"代替"Exec",并将指向你的javascript/vbscript/windowshostscript的文件的完整路径赋值给它。
#30
学习/////
#31
至于 Band 这东西就比较多了,除了IE的历史/媒体等“band”,还有realplayer等软件自己实现的——实际上实现一个最简单的Band也不需要写程序,修改注册表就可以创建一个Band并用html作为其显示的内容——比如做一个自己的搜索入口。
而WindowXP以后,新增了不少Band,比如桌面任务条上可以创建各种Band,甚至像 MediaPlayer9 那样可以最小化到任务条上变成一个和输入法一样的Band,还可以弹出一个小窗口播放video ! 呵呵,这些就不多说了,你慢慢看资料吧。
而WindowXP以后,新增了不少Band,比如桌面任务条上可以创建各种Band,甚至像 MediaPlayer9 那样可以最小化到任务条上变成一个和输入法一样的Band,还可以弹出一个小窗口播放video ! 呵呵,这些就不多说了,你慢慢看资料吧。
#32
To:piggybank(吞硬币的小猪)
我超级超级^999次方晕死。大哥啊!!我都说了N^999次了。我不需要对IE的操作啊!
-------------------------------------------------------------------
还有,不是对IE来操作,是对资源管理器(或者我的电脑)的操作!(有朋友总是告诉我在IE上添加按纽,不是我想要的.)
-------------------------------------------------------------------
我都神经质了~~晕~谁在告诉我关于IE的我可不给分了哦! :)
我超级超级^999次方晕死。大哥啊!!我都说了N^999次了。我不需要对IE的操作啊!
-------------------------------------------------------------------
还有,不是对IE来操作,是对资源管理器(或者我的电脑)的操作!(有朋友总是告诉我在IE上添加按纽,不是我想要的.)
-------------------------------------------------------------------
我都神经质了~~晕~谁在告诉我关于IE的我可不给分了哦! :)
#33
仁兄们回答问题之前拜托看清楚问题好吗?谁在回答对IE的操作我要咬人了啊!!
#34
做成一个COM,实现前面说的接口,注册到
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Explorer Bars\{Your COM GUID}
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Explorer Bars\{Your COM GUID}
#35
To:piggybank(吞硬币的小猪)
哥哥,不否认您的资料很有价值,我花了一晚上时间完成了您文章中所说对“Band”的操作。在IE能实现的很好。 我非常感谢您的回答。
但是,您的答案并非是我所需求的。因为在IE中添加相关键值内容后,并不能再资源管理器中的Toobar显示出来。所以在我的这个问题上,您的文章对我没有帮助。
谢谢。
哥哥,不否认您的资料很有价值,我花了一晚上时间完成了您文章中所说对“Band”的操作。在IE能实现的很好。 我非常感谢您的回答。
但是,您的答案并非是我所需求的。因为在IE中添加相关键值内容后,并不能再资源管理器中的Toobar显示出来。所以在我的这个问题上,您的文章对我没有帮助。
谢谢。
#36
我来顶!!!
#37
我帮你顶!
#38
up
#39
那三个API是专门处理Hook
找本参考书看吧
推荐:
《Visual BASIC Win32 API 编程》
Steven Roman著
找本参考书看吧
推荐:
《Visual BASIC Win32 API 编程》
Steven Roman著
#40
To zyl910(910:分儿,我又来了!) 兄:
好的。我星期天去买。不知道贵不贵哦。 :)
好的。我星期天去买。不知道贵不贵哦。 :)
#41
和你一样,学点儿东西
#42
65.00¥
#43
up
#44
哦!好的!65元尚可承受。:)
说不定还给8。5折呢。 :)
拜托朋友们~在帮忙回答第二个问题吧。开贴另给200分啊! 55555555555
说不定还给8。5折呢。 :)
拜托朋友们~在帮忙回答第二个问题吧。开贴另给200分啊! 55555555555
#45
sorry 前面没仔细看
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar\{Your COM GUID}
关掉所有的 explorer 再打开试试看,在资源管理器菜单的“查看”下面有没有你的 toolbar ?
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar\{Your COM GUID}
关掉所有的 explorer 再打开试试看,在资源管理器菜单的“查看”下面有没有你的 toolbar ?
#46
To:piggybank(吞硬币的小猪)
没有的。5555555555555555.
没有的。5555555555555555.
#47
补充一下,别弄错了
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar\
创建一个新的键值,类型为二进制,名字为{Your GUID}
类型改为string似乎也可以 x(
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar\
创建一个新的键值,类型为二进制,名字为{Your GUID}
类型改为string似乎也可以 x(
#48
To:piggybank(吞硬币的小猪)
感谢大侠指点!!!您的这句话终于回答道位置上了。 :) 不过您说的这一点我已经做到了。然后呢?我可以在资源管理器中的右键,实现出来我添加文字的字样。但是如何增加Toolbar呢?增加了后如何在上边添加应用程序的启动按钮呢? 让我写什么Com之类的我觉得比较困难啊!我是菜鸟的。:(
期待您的回答!!!
感谢大侠指点!!!您的这句话终于回答道位置上了。 :) 不过您说的这一点我已经做到了。然后呢?我可以在资源管理器中的右键,实现出来我添加文字的字样。但是如何增加Toolbar呢?增加了后如何在上边添加应用程序的启动按钮呢? 让我写什么Com之类的我觉得比较困难啊!我是菜鸟的。:(
期待您的回答!!!
#49
VB 做 toolbar 的com似乎不行啊(有一些高级方法没测试过),上面说的
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar\
创建一个新的键值,类型为二进制,名字为{Your GUID}
需要你做一个组件实现一些特别接口才行——例如 flashget 和 天网搜索等。这些com如果注册到上面说的位置,就可以同时出现在资源管理器和ie的工具条上了。
另外做资源管理器的右键菜单要做到Winzip或更强(例如 Picaview那样对图片文件点右键能够预览)也需要COM,VB实现不了那几个接口(我不确定,虽然VB可以实现很多接口,但没试过。或许 hack vb 可以做到,参考《高级VisualBasic编程》一书)。
对资源管理器还可以做很多事情,比如动态改变特定的一些文件的图标——比如同样是一个.txt文件,内容中包含指定的内容或长度大于指定大小可以让它的图标与别的.txt不同,还可以改变鼠标浮动到一个文件上面时显示的tooltip的内容等等,但
要写 com 实现一些特殊接口。
呵呵,我不知道明后天是否有时间。如果有空倒是可以试试看用vb是否能做到,抱歉啦。
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar\
创建一个新的键值,类型为二进制,名字为{Your GUID}
需要你做一个组件实现一些特别接口才行——例如 flashget 和 天网搜索等。这些com如果注册到上面说的位置,就可以同时出现在资源管理器和ie的工具条上了。
另外做资源管理器的右键菜单要做到Winzip或更强(例如 Picaview那样对图片文件点右键能够预览)也需要COM,VB实现不了那几个接口(我不确定,虽然VB可以实现很多接口,但没试过。或许 hack vb 可以做到,参考《高级VisualBasic编程》一书)。
对资源管理器还可以做很多事情,比如动态改变特定的一些文件的图标——比如同样是一个.txt文件,内容中包含指定的内容或长度大于指定大小可以让它的图标与别的.txt不同,还可以改变鼠标浮动到一个文件上面时显示的tooltip的内容等等,但
要写 com 实现一些特殊接口。
呵呵,我不知道明后天是否有时间。如果有空倒是可以试试看用vb是否能做到,抱歉啦。
#50
To:piggybank(吞硬币的高手高手高高手),
哥哥!!你果然是高人啊!说到俺心里了!!您的意思俺明白了~但是现在我的问题该怎么办呢??是不是没有办法解决了?我狂晕死啊啊!真的是困扰我很久很久了。唉~到最后居然不能解决吗? 拜托你啊!想想办法帮小弟。 感激不尽! 请你吃饭!!来大连玩俺以身相许!!
晚上我也在努力试验看看。
谢谢高人!!
哥哥!!你果然是高人啊!说到俺心里了!!您的意思俺明白了~但是现在我的问题该怎么办呢??是不是没有办法解决了?我狂晕死啊啊!真的是困扰我很久很久了。唉~到最后居然不能解决吗? 拜托你啊!想想办法帮小弟。 感激不尽! 请你吃饭!!来大连玩俺以身相许!!
晚上我也在努力试验看看。
谢谢高人!!
#1
IE右键菜单:
HKEY_USERS\.DEFAULT\Software\Microsoft\Internet Explorer\MenuExt\自定义菜单名字
(默认)=“C:\PROGRAM FILES\自定义菜单名字\自定义菜单名字.htm”
IE工具栏按钮:
参考一下以下的位置
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Extensions
其实不管是资源管理器还是IE,里面的“链接”还是“工具栏”都是调用注册表中的某一位置
要不微软为什么把IE捆绑在Windows中一起销售呢?
有时间的话,参考并且斧正一下我的程序,谢谢在先!
http://www.wjez.net/wchsoft/ipage2.htm
(严防死守)你需要的问题在:“IE设置”----“下一步”
HKEY_USERS\.DEFAULT\Software\Microsoft\Internet Explorer\MenuExt\自定义菜单名字
(默认)=“C:\PROGRAM FILES\自定义菜单名字\自定义菜单名字.htm”
IE工具栏按钮:
参考一下以下的位置
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Extensions
其实不管是资源管理器还是IE,里面的“链接”还是“工具栏”都是调用注册表中的某一位置
要不微软为什么把IE捆绑在Windows中一起销售呢?
有时间的话,参考并且斧正一下我的程序,谢谢在先!
http://www.wjez.net/wchsoft/ipage2.htm
(严防死守)你需要的问题在:“IE设置”----“下一步”
#2
1.SetWindowsHookEx
【VB声明】
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
【别名】
SetWindowsHookExA
实例
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
【VB声明】
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
【别名】
SetWindowsHookExA
实例
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
#3
1.SetWindowsHookEx
【VB声明】
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
【别名】
SetWindowsHookExA
实例
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
【VB声明】
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
【别名】
SetWindowsHookExA
实例
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
#4
2.UnhookWindowsHookEx
【VB声明】
Private Declare Function UnhookWindowsHookEx Lib "user32" Alias "UnhookWindowsHookEx" (ByVal hHook As Long) As Long
实例:
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
3.CallNextHookEx
【VB声明】
Private Declare Function CallNextHookEx Lib "user32" Alias "CallNextHookEx" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
实例:
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
【VB声明】
Private Declare Function UnhookWindowsHookEx Lib "user32" Alias "UnhookWindowsHookEx" (ByVal hHook As Long) As Long
实例:
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
3.CallNextHookEx
【VB声明】
Private Declare Function CallNextHookEx Lib "user32" Alias "CallNextHookEx" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
实例:
'In a module
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
#5
up
#6
SetWindowsHookEx,UnhookWindowsHookEx,CallNextHookEx谁说在MSDN中没有说明的?这三个函数和钩子函数有关,SetWindowsHookEx用于设置一个钩子函数,UnhookWindowsHookEx用于卸载一个钩子函数,CallNextHookEx调用钩子函数链中的下一个钩子函数。
SetWindowsHookEx Function
--------------------------------------------------------------------------------
The SetWindowsHookEx function installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor the system for certain types of events. These events are associated either with a specific thread or with all threads in the same desktop as the calling thread.
Syntax
HHOOK SetWindowsHookEx( int idHook,
HOOKPROC lpfn,
HINSTANCE hMod,
DWORD dwThreadId
);
Parameters
idHook
[in] Specifies the type of hook procedure to be installed. This parameter can be one of the following values.
WH_CALLWNDPROC
Installs a hook procedure that monitors messages before the system sends them to the destination window procedure. For more information, see the CallWndProc hook procedure.
WH_CALLWNDPROCRET
Installs a hook procedure that monitors messages after they have been processed by the destination window procedure. For more information, see the CallWndRetProc hook procedure.
WH_CBT
Installs a hook procedure that receives notifications useful to a computer-based training (CBT) application. For more information, see the CBTProc hook procedure.
WH_DEBUG
Installs a hook procedure useful for debugging other hook procedures. For more information, see the DebugProc hook procedure.
WH_FOREGROUNDIDLE
Installs a hook procedure that will be called when the application's foreground thread is about to become idle. This hook is useful for performing low priority tasks during idle time. For more information, see the ForegroundIdleProc hook procedure.
WH_GETMESSAGE
Installs a hook procedure that monitors messages posted to a message queue. For more information, see the GetMsgProc hook procedure.
WH_JOURNALPLAYBACK
Installs a hook procedure that posts messages previously recorded by a WH_JOURNALRECORD hook procedure. For more information, see the JournalPlaybackProc hook procedure.
WH_JOURNALRECORD
Installs a hook procedure that records input messages posted to the system message queue. This hook is useful for recording macros. For more information, see the JournalRecordProc hook procedure.
WH_KEYBOARD
Installs a hook procedure that monitors keystroke messages. For more information, see the KeyboardProc hook procedure.
WH_KEYBOARD_LL
Windows NT/2000/XP: Installs a hook procedure that monitors low-level keyboard input events. For more information, see the LowLevelKeyboardProc hook procedure.
WH_MOUSE
Installs a hook procedure that monitors mouse messages. For more information, see the MouseProc hook procedure.
WH_MOUSE_LL
Windows NT/2000/XP: Installs a hook procedure that monitors low-level mouse input events. For more information, see the LowLevelMouseProc hook procedure.
WH_MSGFILTER
Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. For more information, see the MessageProc hook procedure.
WH_SHELL
Installs a hook procedure that receives notifications useful to shell applications. For more information, see the ShellProc hook procedure.
WH_SYSMSGFILTER
Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. The hook procedure monitors these messages for all applications in the same desktop as the calling thread. For more information, see the SysMsgProc hook procedure.
lpfn
[in] Pointer to the hook procedure. If the dwThreadId parameter is zero or specifies the identifier of a thread created by a different process, the lpfn parameter must point to a hook procedure in a dynamic-link library (DLL). Otherwise, lpfn can point to a hook procedure in the code associated with the current process.
hMod
[in] Handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process.
dwThreadId
[in] Specifies the identifier of the thread with which the hook procedure is to be associated. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread.
Return Value
If the function succeeds, the return value is the handle to the hook procedure.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
An error may occur if the hMod parameter is NULL and the dwThreadId parameter is zero or specifies the identifier of a thread created by another process.
Calling the CallNextHookEx function to chain to the next hook procedure is optional, but it is highly recommended; otherwise, other applications that have installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.
Before terminating, an application must call the UnhookWindowsHookEx function to free system resources associated with the hook.
The scope of a hook depends on the hook type. Some hooks can be set only with global scope; others can also be set for only a specific thread, as shown in the following table.
Hook Scope
WH_CALLWNDPROC Thread or global
WH_CALLWNDPROCRET Thread or global
WH_CBT Thread or global
WH_DEBUG Thread or global
WH_FOREGROUNDIDLE Thread or global
WH_GETMESSAGE Thread or global
WH_JOURNALPLAYBACK Global only
WH_JOURNALRECORD Global only
WH_KEYBOARD Thread or global
WH_KEYBOARD_LL Global only
WH_MOUSE Thread or global
WH_MOUSE_LL Global only
WH_MSGFILTER Thread or global
WH_SHELL Thread or global
WH_SYSMSGFILTER Global only
For a specified hook type, thread hooks are called first, then global hooks.
The global hooks are a shared resource, and installing one affects all applications in the same desktop as the calling thread. All global hook functions must be in libraries. Global hooks should be restricted to special-purpose applications or to use as a development aid during application debugging. Libraries that no longer need a hook should remove its hook procedure.
Windows 95/98/Me: SetWindowsHookEx is supported by the Microsoft® Layer for Unicode (MSLU). However, it does not make conversions. To see Unicode messages, notifications, and so forth, you must subclass the window. To use this version of the application programming interface (API), you must add certain files to your application, as outlined in Installing and Releasing Hook Procedures
SetWindowsHookEx Function
--------------------------------------------------------------------------------
The SetWindowsHookEx function installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor the system for certain types of events. These events are associated either with a specific thread or with all threads in the same desktop as the calling thread.
Syntax
HHOOK SetWindowsHookEx( int idHook,
HOOKPROC lpfn,
HINSTANCE hMod,
DWORD dwThreadId
);
Parameters
idHook
[in] Specifies the type of hook procedure to be installed. This parameter can be one of the following values.
WH_CALLWNDPROC
Installs a hook procedure that monitors messages before the system sends them to the destination window procedure. For more information, see the CallWndProc hook procedure.
WH_CALLWNDPROCRET
Installs a hook procedure that monitors messages after they have been processed by the destination window procedure. For more information, see the CallWndRetProc hook procedure.
WH_CBT
Installs a hook procedure that receives notifications useful to a computer-based training (CBT) application. For more information, see the CBTProc hook procedure.
WH_DEBUG
Installs a hook procedure useful for debugging other hook procedures. For more information, see the DebugProc hook procedure.
WH_FOREGROUNDIDLE
Installs a hook procedure that will be called when the application's foreground thread is about to become idle. This hook is useful for performing low priority tasks during idle time. For more information, see the ForegroundIdleProc hook procedure.
WH_GETMESSAGE
Installs a hook procedure that monitors messages posted to a message queue. For more information, see the GetMsgProc hook procedure.
WH_JOURNALPLAYBACK
Installs a hook procedure that posts messages previously recorded by a WH_JOURNALRECORD hook procedure. For more information, see the JournalPlaybackProc hook procedure.
WH_JOURNALRECORD
Installs a hook procedure that records input messages posted to the system message queue. This hook is useful for recording macros. For more information, see the JournalRecordProc hook procedure.
WH_KEYBOARD
Installs a hook procedure that monitors keystroke messages. For more information, see the KeyboardProc hook procedure.
WH_KEYBOARD_LL
Windows NT/2000/XP: Installs a hook procedure that monitors low-level keyboard input events. For more information, see the LowLevelKeyboardProc hook procedure.
WH_MOUSE
Installs a hook procedure that monitors mouse messages. For more information, see the MouseProc hook procedure.
WH_MOUSE_LL
Windows NT/2000/XP: Installs a hook procedure that monitors low-level mouse input events. For more information, see the LowLevelMouseProc hook procedure.
WH_MSGFILTER
Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. For more information, see the MessageProc hook procedure.
WH_SHELL
Installs a hook procedure that receives notifications useful to shell applications. For more information, see the ShellProc hook procedure.
WH_SYSMSGFILTER
Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. The hook procedure monitors these messages for all applications in the same desktop as the calling thread. For more information, see the SysMsgProc hook procedure.
lpfn
[in] Pointer to the hook procedure. If the dwThreadId parameter is zero or specifies the identifier of a thread created by a different process, the lpfn parameter must point to a hook procedure in a dynamic-link library (DLL). Otherwise, lpfn can point to a hook procedure in the code associated with the current process.
hMod
[in] Handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process.
dwThreadId
[in] Specifies the identifier of the thread with which the hook procedure is to be associated. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread.
Return Value
If the function succeeds, the return value is the handle to the hook procedure.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
An error may occur if the hMod parameter is NULL and the dwThreadId parameter is zero or specifies the identifier of a thread created by another process.
Calling the CallNextHookEx function to chain to the next hook procedure is optional, but it is highly recommended; otherwise, other applications that have installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.
Before terminating, an application must call the UnhookWindowsHookEx function to free system resources associated with the hook.
The scope of a hook depends on the hook type. Some hooks can be set only with global scope; others can also be set for only a specific thread, as shown in the following table.
Hook Scope
WH_CALLWNDPROC Thread or global
WH_CALLWNDPROCRET Thread or global
WH_CBT Thread or global
WH_DEBUG Thread or global
WH_FOREGROUNDIDLE Thread or global
WH_GETMESSAGE Thread or global
WH_JOURNALPLAYBACK Global only
WH_JOURNALRECORD Global only
WH_KEYBOARD Thread or global
WH_KEYBOARD_LL Global only
WH_MOUSE Thread or global
WH_MOUSE_LL Global only
WH_MSGFILTER Thread or global
WH_SHELL Thread or global
WH_SYSMSGFILTER Global only
For a specified hook type, thread hooks are called first, then global hooks.
The global hooks are a shared resource, and installing one affects all applications in the same desktop as the calling thread. All global hook functions must be in libraries. Global hooks should be restricted to special-purpose applications or to use as a development aid during application debugging. Libraries that no longer need a hook should remove its hook procedure.
Windows 95/98/Me: SetWindowsHookEx is supported by the Microsoft® Layer for Unicode (MSLU). However, it does not make conversions. To see Unicode messages, notifications, and so forth, you must subclass the window. To use this version of the application programming interface (API), you must add certain files to your application, as outlined in Installing and Releasing Hook Procedures
#7
UnhookWindowsHookEx Function
--------------------------------------------------------------------------------
The UnhookWindowsHookEx function removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.
Syntax
BOOL UnhookWindowsHookEx( HHOOK hhk
);
Parameters
hhk
[in] Handle to the hook to be removed. This parameter is a hook handle obtained by a previous call to SetWindowsHookEx.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
The hook procedure can be in the state of being called by another thread even after UnhookWindowsHookEx returns. If the hook procedure is not being called concurrently, the hook procedure is removed immediately before UnhookWindowsHookEx returns.
--------------------------------------------------------------------------------
The UnhookWindowsHookEx function removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.
Syntax
BOOL UnhookWindowsHookEx( HHOOK hhk
);
Parameters
hhk
[in] Handle to the hook to be removed. This parameter is a hook handle obtained by a previous call to SetWindowsHookEx.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
The hook procedure can be in the state of being called by another thread even after UnhookWindowsHookEx returns. If the hook procedure is not being called concurrently, the hook procedure is removed immediately before UnhookWindowsHookEx returns.
#8
CallNextHookEx Function
--------------------------------------------------------------------------------
The CallNextHookEx function passes the hook information to the next hook procedure in the current hook chain. A hook procedure can call this function either before or after processing the hook information.
Syntax
LRESULT CallNextHookEx( HHOOK hhk,
int nCode,
WPARAM wParam,
LPARAM lParam
);
Parameters
hhk
[in] Handle to the current hook. An application receives this handle as a result of a previous call to the SetWindowsHookEx function.
nCode
[in] Specifies the hook code passed to the current hook procedure. The next hook procedure uses this code to determine how to process the hook information.
wParam
[in] Specifies the wParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain.
lParam
[in] Specifies the lParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain.
Return Value
This value is returned by the next hook procedure in the chain. The current hook procedure must also return this value. The meaning of the return value depends on the hook type. For more information, see the descriptions of the individual hook procedures.
Remarks
Hook procedures are installed in chains for particular hook types. CallNextHookEx calls the next hook in the chain.
Calling CallNextHookEx is optional, but it is highly recommended; otherwise, other applications that have installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.
--------------------------------------------------------------------------------
The CallNextHookEx function passes the hook information to the next hook procedure in the current hook chain. A hook procedure can call this function either before or after processing the hook information.
Syntax
LRESULT CallNextHookEx( HHOOK hhk,
int nCode,
WPARAM wParam,
LPARAM lParam
);
Parameters
hhk
[in] Handle to the current hook. An application receives this handle as a result of a previous call to the SetWindowsHookEx function.
nCode
[in] Specifies the hook code passed to the current hook procedure. The next hook procedure uses this code to determine how to process the hook information.
wParam
[in] Specifies the wParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain.
lParam
[in] Specifies the lParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain.
Return Value
This value is returned by the next hook procedure in the chain. The current hook procedure must also return this value. The meaning of the return value depends on the hook type. For more information, see the descriptions of the individual hook procedures.
Remarks
Hook procedures are installed in chains for particular hook types. CallNextHookEx calls the next hook in the chain.
Calling CallNextHookEx is optional, but it is highly recommended; otherwise, other applications that have installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.
#9
yunok (★ 杨云鹏,用VB,向高手们学习! ★):你的第二个问题,是嵌入式软件使用的方法,请版主来回答吧。也许VB难以实现(用C)
#10
=========================================================================
其实不管是资源管理器还是IE,里面的“链接”还是“工具栏”都是调用注册表中的某一位置
要不微软为什么把IE捆绑在Windows中一起销售呢?
=========================================================================
To: wchsoft(无名工作室) 兄:
IE和资源管理器里面的“链接”,"地址栏”,的确是调用同一地址的,但是和第三方应用程序加入的快捷栏却是不同的. 如果您不相信,请您亲自试一试,我试试验了多次实在没有办法才来麻烦大家的. 还有,微软把IE捆绑在Windows中一起销售,一是为了打跨其他浏览器,比如网景等等,而是为了迅速扩大垄断地位. 这个我的题目要求有什么关系??我不明白.
其实不管是资源管理器还是IE,里面的“链接”还是“工具栏”都是调用注册表中的某一位置
要不微软为什么把IE捆绑在Windows中一起销售呢?
=========================================================================
To: wchsoft(无名工作室) 兄:
IE和资源管理器里面的“链接”,"地址栏”,的确是调用同一地址的,但是和第三方应用程序加入的快捷栏却是不同的. 如果您不相信,请您亲自试一试,我试试验了多次实在没有办法才来麻烦大家的. 还有,微软把IE捆绑在Windows中一起销售,一是为了打跨其他浏览器,比如网景等等,而是为了迅速扩大垄断地位. 这个我的题目要求有什么关系??我不明白.
#11
To: qingming81(晴明) gcj123(佛的光辉)
我想知道3个Api函数各个参数的详细意义呀.这些例子在Snow_Win32Api中我也找到但过得. :( 当然,看完这些例子也很有帮助的. 谢谢你们!
我想知道3个Api函数各个参数的详细意义呀.这些例子在Snow_Win32Api中我也找到但过得. :( 当然,看完这些例子也很有帮助的. 谢谢你们!
#12
不知道你是否装了聊天软件“雅虎通”,建议你装一装,在装之前把注册表导出,装之后再导出,然后通过FC比较到一个文本文件中,看看该文本文件,我相信你会有很大的收获的。
#13
===========================================================================
yunok (★ 杨云鹏,用VB,向高手们学习! ★):你的第二个问题,是嵌入式软件使用的方法,请版主来回答吧。也许VB难以实现(用C)
===========================================================================
To: qingming81(晴明) :
通过注册表可以解决的,我已经可以做到在资源管理器工具栏处点击鼠标右键出来"凝尘软件"字样的菜单了(就是跟在"链接"下面多出来的.呵呵),只是现在还不知道如何出来一个Toolbar,并且上边有我的应用程序. :(
yunok (★ 杨云鹏,用VB,向高手们学习! ★):你的第二个问题,是嵌入式软件使用的方法,请版主来回答吧。也许VB难以实现(用C)
===========================================================================
To: qingming81(晴明) :
通过注册表可以解决的,我已经可以做到在资源管理器工具栏处点击鼠标右键出来"凝尘软件"字样的菜单了(就是跟在"链接"下面多出来的.呵呵),只是现在还不知道如何出来一个Toolbar,并且上边有我的应用程序. :(
#14
==========================================================================
不知道你是否装了聊天软件“雅虎通”,建议你装一装,在装之前把注册表导出,装之后再导出,然后通过FC比较到一个文本文件中,看看该文本文件,我相信你会有很大的收获的。
==========================================================================
To: wchsoft(无名工作室)
我装过瑞星,诺顿,3721上网助手,雅虎通,金山独霸等等.我除了用过FC以外,还用过 多种 Reg快照软件来进行对比过. 但是,所有软件的写注册表方法和键值统统是不定的,且无规律可循的. 甚至装2次同样的软件,写注册表的位置都不同. 我晕. 所以才来请教高人的.
不知道你是否装了聊天软件“雅虎通”,建议你装一装,在装之前把注册表导出,装之后再导出,然后通过FC比较到一个文本文件中,看看该文本文件,我相信你会有很大的收获的。
==========================================================================
To: wchsoft(无名工作室)
我装过瑞星,诺顿,3721上网助手,雅虎通,金山独霸等等.我除了用过FC以外,还用过 多种 Reg快照软件来进行对比过. 但是,所有软件的写注册表方法和键值统统是不定的,且无规律可循的. 甚至装2次同样的软件,写注册表的位置都不同. 我晕. 所以才来请教高人的.
#15
To: wchsoft(无名工作室)
您的软件"IE严防死守"我看了, 挺好的.但是功能和效果(甚至可用价值)上还有一些缺陷,请参看我主页上(http://ioi.xiloo.com)的卢培培作品“注册表大师”,我认为是相当好的作品。另外,不才我也有很多对Api操作(类似于超级兔子)的东东,请您下载参看。
请恕在下直言,您的软件在实用率上并没有太大特色,至于能有多少用户使用,请您不妨做个调查试试看。:) 努力!
您的软件"IE严防死守"我看了, 挺好的.但是功能和效果(甚至可用价值)上还有一些缺陷,请参看我主页上(http://ioi.xiloo.com)的卢培培作品“注册表大师”,我认为是相当好的作品。另外,不才我也有很多对Api操作(类似于超级兔子)的东东,请您下载参看。
请恕在下直言,您的软件在实用率上并没有太大特色,至于能有多少用户使用,请您不妨做个调查试试看。:) 努力!
#16
http://www.eaoo.com/design/list.asp?classid=2&Nclassid=12
#17
TO:cnpr(-----)
谢谢您给我的网站,但是没有我需要的答案.
谢谢您给我的网站,但是没有我需要的答案.
#18
搂主啊,我上面的回复已经都说了阿,只不过是英文的,耐心的看吧
#19
工具栏的按钮一般在HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Extensions
不过如果你想在工具栏上添加按钮的话,好象先要在系统中注册一个键值。如:
{ABFC18BB-ED0C-425d-9EF4-42624205BBA4}
至于“雅虎通”,我刚刚接到朋友推荐,对于他为什么在工具栏上写那么多的信息,我还在研究。注意,“雅虎通”是在IE上另外建立一个工具栏区域。
不过如果你想在工具栏上添加按钮的话,好象先要在系统中注册一个键值。如:
{ABFC18BB-ED0C-425d-9EF4-42624205BBA4}
至于“雅虎通”,我刚刚接到朋友推荐,对于他为什么在工具栏上写那么多的信息,我还在研究。注意,“雅虎通”是在IE上另外建立一个工具栏区域。
#20
To: gcj123(佛的光辉)
哦!!!十二分Sorry啊!都怪我粗心啊!看见E文就头大.呵呵.谢谢你啊!api解释我要带回家边翻字典边看了! 呵呵。
哦!!!十二分Sorry啊!都怪我粗心啊!看见E文就头大.呵呵.谢谢你啊!api解释我要带回家边翻字典边看了! 呵呵。
#21
To:wchsoft(无名工作室)
我的题目您可有认真的看呢?我已经说明了:
----------------------------------
还有,不是对IE来操作,是对资源管理器(或者我的电脑)的操作!(有朋友总是告诉我在IE上添加按纽,不是我想要的.)
----------------------------------
再次强调,我不需要再IE上添加按钮,那个十分简单。7行代码即可实现。我需要的是对资源管理器的操作。
谢谢你。
我的题目您可有认真的看呢?我已经说明了:
----------------------------------
还有,不是对IE来操作,是对资源管理器(或者我的电脑)的操作!(有朋友总是告诉我在IE上添加按纽,不是我想要的.)
----------------------------------
再次强调,我不需要再IE上添加按钮,那个十分简单。7行代码即可实现。我需要的是对资源管理器的操作。
谢谢你。
#22
To:yunok(★ 杨云鹏,用VB,向高手们学习! ★)
谢谢你诚恳的语言!至于你推荐的东西,我会去看的。
在软件的实用率上我知道没有多大的使用价值,正是这个原因或许也有其他的原因,我在两个月之前就放弃了VB,不过现在只是无聊,来看看我的CSDN,能帮助人就帮助人,尽自己的能力吧!
谢谢你诚恳的语言!至于你推荐的东西,我会去看的。
在软件的实用率上我知道没有多大的使用价值,正是这个原因或许也有其他的原因,我在两个月之前就放弃了VB,不过现在只是无聊,来看看我的CSDN,能帮助人就帮助人,尽自己的能力吧!
#23
To:wchsoft(无名工作室)
您的网站留言板已经打不开了。是否需要我给您提供一个(就是类似于我主页上的那个)?Asp做的。您可以直接放在我的空间上管理。请参看http://ioi.xiloo.com的链接。
您的网站留言板已经打不开了。是否需要我给您提供一个(就是类似于我主页上的那个)?Asp做的。您可以直接放在我的空间上管理。请参看http://ioi.xiloo.com的链接。
#24
能力有限!抱歉!yunok(★ 杨云鹏,用VB,向高手们学习! ★) 兄。
#25
再To:wchsoft(无名工作室)
微软支持VB到2008年呢!为什么要放弃呢?(当然,大家也已经开始看.net了嘛! :) )虽然Vb入门容易。但是精通确实是困难的。不过各人有个人的想法,希望您一路走好。
微软支持VB到2008年呢!为什么要放弃呢?(当然,大家也已经开始看.net了嘛! :) )虽然Vb入门容易。但是精通确实是困难的。不过各人有个人的想法,希望您一路走好。
#26
看到hook总觉得和钩子有关!
不过我不懂,帮你up!
不过我不懂,帮你up!
#27
我顶!!!!!
顶!!!!!
顶!!!!!
#28
那几个 API 我就不管了,说你说的 IE 按钮和工具栏。
IE 工具栏上的按钮的添加很简单,不一定要编程,改改注册表就可以了
IE 的历史/搜索/媒体等这样的“窗口”叫做 Band,要写 Band 用 VB 存在一定的困难(其实不是不可以,VB也可以实现很多接口),需要写成COM,并注册到 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Explorer Bars,详细的内容回头再说。
简单说说增加菜单和按钮,拿 flashget 做例子:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Extensions\{D6E814A0-E0C5-11d4-8D29-0050BA6940E3}]
"ButtonText"="FlashGet"
"Default Visible"="Yes"
"Exec"="D:\\play\\工具软件\\工具软件\\FLASHGET\\flashget.exe"
"HotIcon"="D:\\play\\工具软件\\工具软件\\FLASHGET\\flashget.exe,128"
"Icon"="D:\\play\\工具软件\\工具软件\\FLASHGET\\flashget.exe,223"
"CLSID"="{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}"
"MenuStatusBar"="FlashGet"
"MenuText"="&FlashGet"
1、在 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Extensions
创建一个新的项,并用 genguid 生成一个 guid 作为名字,例如 flashget 的
{D6E814A0-E0C5-11d4-8D29-0050BA6940E3},你需要换一个不重复的哦
2、添加若干key,如 ButtonText MenuStatusBar 等描述信息
3、添加 Exec 指向你的执行程序
4、为它添加图表文件和激活图表文件 Icon 和 HotIcon
5、一定要创建一个 CLSID,值必须为"{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}",这告诉 IE 它是一个menuitem
6、Flashget 没有这一项,你可以创建string类型的key,名为 MenuCustomize ,值为"help",如果有这个MenuCustomize且为"help",你新增的这一菜单项就跑到“帮助”菜单项下,否则是“工具”菜单项下。
好了,你可以修改 flashget 的注册表试试看效果——别忘记关掉IE,重新打开。
IE 工具栏上的按钮的添加很简单,不一定要编程,改改注册表就可以了
IE 的历史/搜索/媒体等这样的“窗口”叫做 Band,要写 Band 用 VB 存在一定的困难(其实不是不可以,VB也可以实现很多接口),需要写成COM,并注册到 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Explorer Bars,详细的内容回头再说。
简单说说增加菜单和按钮,拿 flashget 做例子:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Extensions\{D6E814A0-E0C5-11d4-8D29-0050BA6940E3}]
"ButtonText"="FlashGet"
"Default Visible"="Yes"
"Exec"="D:\\play\\工具软件\\工具软件\\FLASHGET\\flashget.exe"
"HotIcon"="D:\\play\\工具软件\\工具软件\\FLASHGET\\flashget.exe,128"
"Icon"="D:\\play\\工具软件\\工具软件\\FLASHGET\\flashget.exe,223"
"CLSID"="{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}"
"MenuStatusBar"="FlashGet"
"MenuText"="&FlashGet"
1、在 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Extensions
创建一个新的项,并用 genguid 生成一个 guid 作为名字,例如 flashget 的
{D6E814A0-E0C5-11d4-8D29-0050BA6940E3},你需要换一个不重复的哦
2、添加若干key,如 ButtonText MenuStatusBar 等描述信息
3、添加 Exec 指向你的执行程序
4、为它添加图表文件和激活图表文件 Icon 和 HotIcon
5、一定要创建一个 CLSID,值必须为"{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}",这告诉 IE 它是一个menuitem
6、Flashget 没有这一项,你可以创建string类型的key,名为 MenuCustomize ,值为"help",如果有这个MenuCustomize且为"help",你新增的这一菜单项就跑到“帮助”菜单项下,否则是“工具”菜单项下。
好了,你可以修改 flashget 的注册表试试看效果——别忘记关掉IE,重新打开。
#29
这样你的IE的“工具”或者“帮助”菜单里会多了一项,工具条上也会多了一个按钮。
如果你希望用它调用一个com,而不是exe文件,那么不用创建 "Exec" 项,改为 ClsidExtension,并填写你的COM的 GUID——注意,该COM必需实现了IOleCommandTarget和IObjectWithSite(具体方法查MSDN吧,我不记得了)
如果你不想执行exe,也不想调用com,可以让这个菜单项或按钮调用一个script:用"Script"代替"Exec",并将指向你的javascript/vbscript/windowshostscript的文件的完整路径赋值给它。
如果你希望用它调用一个com,而不是exe文件,那么不用创建 "Exec" 项,改为 ClsidExtension,并填写你的COM的 GUID——注意,该COM必需实现了IOleCommandTarget和IObjectWithSite(具体方法查MSDN吧,我不记得了)
如果你不想执行exe,也不想调用com,可以让这个菜单项或按钮调用一个script:用"Script"代替"Exec",并将指向你的javascript/vbscript/windowshostscript的文件的完整路径赋值给它。
#30
学习/////
#31
至于 Band 这东西就比较多了,除了IE的历史/媒体等“band”,还有realplayer等软件自己实现的——实际上实现一个最简单的Band也不需要写程序,修改注册表就可以创建一个Band并用html作为其显示的内容——比如做一个自己的搜索入口。
而WindowXP以后,新增了不少Band,比如桌面任务条上可以创建各种Band,甚至像 MediaPlayer9 那样可以最小化到任务条上变成一个和输入法一样的Band,还可以弹出一个小窗口播放video ! 呵呵,这些就不多说了,你慢慢看资料吧。
而WindowXP以后,新增了不少Band,比如桌面任务条上可以创建各种Band,甚至像 MediaPlayer9 那样可以最小化到任务条上变成一个和输入法一样的Band,还可以弹出一个小窗口播放video ! 呵呵,这些就不多说了,你慢慢看资料吧。
#32
To:piggybank(吞硬币的小猪)
我超级超级^999次方晕死。大哥啊!!我都说了N^999次了。我不需要对IE的操作啊!
-------------------------------------------------------------------
还有,不是对IE来操作,是对资源管理器(或者我的电脑)的操作!(有朋友总是告诉我在IE上添加按纽,不是我想要的.)
-------------------------------------------------------------------
我都神经质了~~晕~谁在告诉我关于IE的我可不给分了哦! :)
我超级超级^999次方晕死。大哥啊!!我都说了N^999次了。我不需要对IE的操作啊!
-------------------------------------------------------------------
还有,不是对IE来操作,是对资源管理器(或者我的电脑)的操作!(有朋友总是告诉我在IE上添加按纽,不是我想要的.)
-------------------------------------------------------------------
我都神经质了~~晕~谁在告诉我关于IE的我可不给分了哦! :)
#33
仁兄们回答问题之前拜托看清楚问题好吗?谁在回答对IE的操作我要咬人了啊!!
#34
做成一个COM,实现前面说的接口,注册到
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Explorer Bars\{Your COM GUID}
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Explorer Bars\{Your COM GUID}
#35
To:piggybank(吞硬币的小猪)
哥哥,不否认您的资料很有价值,我花了一晚上时间完成了您文章中所说对“Band”的操作。在IE能实现的很好。 我非常感谢您的回答。
但是,您的答案并非是我所需求的。因为在IE中添加相关键值内容后,并不能再资源管理器中的Toobar显示出来。所以在我的这个问题上,您的文章对我没有帮助。
谢谢。
哥哥,不否认您的资料很有价值,我花了一晚上时间完成了您文章中所说对“Band”的操作。在IE能实现的很好。 我非常感谢您的回答。
但是,您的答案并非是我所需求的。因为在IE中添加相关键值内容后,并不能再资源管理器中的Toobar显示出来。所以在我的这个问题上,您的文章对我没有帮助。
谢谢。
#36
我来顶!!!
#37
我帮你顶!
#38
up
#39
那三个API是专门处理Hook
找本参考书看吧
推荐:
《Visual BASIC Win32 API 编程》
Steven Roman著
找本参考书看吧
推荐:
《Visual BASIC Win32 API 编程》
Steven Roman著
#40
To zyl910(910:分儿,我又来了!) 兄:
好的。我星期天去买。不知道贵不贵哦。 :)
好的。我星期天去买。不知道贵不贵哦。 :)
#41
和你一样,学点儿东西
#42
65.00¥
#43
up
#44
哦!好的!65元尚可承受。:)
说不定还给8。5折呢。 :)
拜托朋友们~在帮忙回答第二个问题吧。开贴另给200分啊! 55555555555
说不定还给8。5折呢。 :)
拜托朋友们~在帮忙回答第二个问题吧。开贴另给200分啊! 55555555555
#45
sorry 前面没仔细看
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar\{Your COM GUID}
关掉所有的 explorer 再打开试试看,在资源管理器菜单的“查看”下面有没有你的 toolbar ?
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar\{Your COM GUID}
关掉所有的 explorer 再打开试试看,在资源管理器菜单的“查看”下面有没有你的 toolbar ?
#46
To:piggybank(吞硬币的小猪)
没有的。5555555555555555.
没有的。5555555555555555.
#47
补充一下,别弄错了
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar\
创建一个新的键值,类型为二进制,名字为{Your GUID}
类型改为string似乎也可以 x(
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar\
创建一个新的键值,类型为二进制,名字为{Your GUID}
类型改为string似乎也可以 x(
#48
To:piggybank(吞硬币的小猪)
感谢大侠指点!!!您的这句话终于回答道位置上了。 :) 不过您说的这一点我已经做到了。然后呢?我可以在资源管理器中的右键,实现出来我添加文字的字样。但是如何增加Toolbar呢?增加了后如何在上边添加应用程序的启动按钮呢? 让我写什么Com之类的我觉得比较困难啊!我是菜鸟的。:(
期待您的回答!!!
感谢大侠指点!!!您的这句话终于回答道位置上了。 :) 不过您说的这一点我已经做到了。然后呢?我可以在资源管理器中的右键,实现出来我添加文字的字样。但是如何增加Toolbar呢?增加了后如何在上边添加应用程序的启动按钮呢? 让我写什么Com之类的我觉得比较困难啊!我是菜鸟的。:(
期待您的回答!!!
#49
VB 做 toolbar 的com似乎不行啊(有一些高级方法没测试过),上面说的
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar\
创建一个新的键值,类型为二进制,名字为{Your GUID}
需要你做一个组件实现一些特别接口才行——例如 flashget 和 天网搜索等。这些com如果注册到上面说的位置,就可以同时出现在资源管理器和ie的工具条上了。
另外做资源管理器的右键菜单要做到Winzip或更强(例如 Picaview那样对图片文件点右键能够预览)也需要COM,VB实现不了那几个接口(我不确定,虽然VB可以实现很多接口,但没试过。或许 hack vb 可以做到,参考《高级VisualBasic编程》一书)。
对资源管理器还可以做很多事情,比如动态改变特定的一些文件的图标——比如同样是一个.txt文件,内容中包含指定的内容或长度大于指定大小可以让它的图标与别的.txt不同,还可以改变鼠标浮动到一个文件上面时显示的tooltip的内容等等,但
要写 com 实现一些特殊接口。
呵呵,我不知道明后天是否有时间。如果有空倒是可以试试看用vb是否能做到,抱歉啦。
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar\
创建一个新的键值,类型为二进制,名字为{Your GUID}
需要你做一个组件实现一些特别接口才行——例如 flashget 和 天网搜索等。这些com如果注册到上面说的位置,就可以同时出现在资源管理器和ie的工具条上了。
另外做资源管理器的右键菜单要做到Winzip或更强(例如 Picaview那样对图片文件点右键能够预览)也需要COM,VB实现不了那几个接口(我不确定,虽然VB可以实现很多接口,但没试过。或许 hack vb 可以做到,参考《高级VisualBasic编程》一书)。
对资源管理器还可以做很多事情,比如动态改变特定的一些文件的图标——比如同样是一个.txt文件,内容中包含指定的内容或长度大于指定大小可以让它的图标与别的.txt不同,还可以改变鼠标浮动到一个文件上面时显示的tooltip的内容等等,但
要写 com 实现一些特殊接口。
呵呵,我不知道明后天是否有时间。如果有空倒是可以试试看用vb是否能做到,抱歉啦。
#50
To:piggybank(吞硬币的高手高手高高手),
哥哥!!你果然是高人啊!说到俺心里了!!您的意思俺明白了~但是现在我的问题该怎么办呢??是不是没有办法解决了?我狂晕死啊啊!真的是困扰我很久很久了。唉~到最后居然不能解决吗? 拜托你啊!想想办法帮小弟。 感激不尽! 请你吃饭!!来大连玩俺以身相许!!
晚上我也在努力试验看看。
谢谢高人!!
哥哥!!你果然是高人啊!说到俺心里了!!您的意思俺明白了~但是现在我的问题该怎么办呢??是不是没有办法解决了?我狂晕死啊啊!真的是困扰我很久很久了。唉~到最后居然不能解决吗? 拜托你啊!想想办法帮小弟。 感激不尽! 请你吃饭!!来大连玩俺以身相许!!
晚上我也在努力试验看看。
谢谢高人!!