- 浏览: 167770 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
xiangyufangai:
很好很强大膜拜中哈哈!!
VB 两个字符串处理函数(类似Left/Mid/Right/Split的结合) -
hellohank:
这个……叫摘要算法,不叫加密算法~
Java实现的加密工具类(支持MD5和SHA) -
NIUCH1029291561:
接口有问题奥
网银在线支付接口和应用 -
yeuego:
能幫你就行了
MySQL索引分析 -
ForgiDaved:
很给力的介绍。记得前段时间给一个系统加功能,设计的表没有 ...
MySQL索引分析
egisterShellHookWindow Function
--------------------------------------------------------------------------------
Registers a specified Shell window to receive certain messages for events or notifications that are useful to Shell applications. The event messages received are only those sent to the Shell window associated with the specified window's desktop. Many of the messages are the same as those that can be received after calling the SetWindowsHookEx function and specifying WH_SHELL for the hook type. The difference with RegisterShellHookWindow is that the messages are received through the specified window's WindowProc and not through a call back procedure.
Syntax
BOOL RegisterShellHookWindow( HWND hWnd
);
Parameters
hWnd
[in] Handle to the window to register for Shell hook messages.
Return Value
TRUE if the function succeeds; FALSE if the function fails.
Remarks
As with normal window messages, the second parameter of the window procedure identifies the message as a "WM_SHELLHOOKMESSAGE". However, for these Shell hook messages, the message value is not a pre-defined constant like other message IDs such as WM_COMMAND. The value must be obtained dynamically using a call to RegisterWindowMessage(TEXT("SHELLHOOK"));. This precludes handling these messages using a traditional switch statement which requires ID values that are known at compile time. For handling Shell hook messages, the normal practice is to code an If statement in the default section of your switch statement and then handle the message if the value of the message ID is the same as the value obtained from the RegisterWindowMessage call.
The following table describes the wParam and lParam parameter values passed to the window procedure for the Shell hook messages.
wParam lParam
HSHELL_GETMINRECT A pointer to a SHELLHOOKINFO structure.
HSHELL_WINDOWACTIVATEED The HWND handle of the activated window.
HSHELL_RUDEAPPACTIVATEED The HWND handle of the activated window.
HSHELL_WINDOWREPLACING The HWND handle of the window replacing the top-level window.
HSHELL_WINDOWREPLACED The HWND handle of the window being replaced.
HSHELL_WINDOWCreateD The HWND handle of the window being created.
HSHELL_WINDOWDESTROYED The HWND handle of the top-level window being destroyed.
HSHELL_ACTIVATESHELLWINDOW Not used.
HSHELL_TASKMAN Can be ignored.
HSHELL_REDRAW The HWND handle of the window that needs to be redrawn.
HSHELL_FLASH The HWND handle of the window that needs to be flashed.
HSHELL_ENDTASK The HWND handle of the window that should be forced to exit.
HSHELL_APPCOMMAND The APPCOMMAND which has been unhandled by the application or other hooks. See WM_APPCOMMAND and use the GET_APPCOMMAND_LPARAM macro to retrieve this parameter.
Although you can access this function by using LoadLibrary and GetProcAddress combined in Microsoft Windows versions prior to Windows XP, the function is not accessible using the standard Include file and library linkage. The header files included in Windows XPÂ Service Pack 1 (SP1) and Windows Server 2003 document this function and make it accessible using the appropriate Include file and library linkage. However, this function is not intended for general use. It is recommended that you do not use it in new programs because it might be altered or unavailable in subsequent versions of Windows.
Function Information
Minimum DLL Version user32.dll
Header Declared in Winuser.h, include Windows.h
Import library User32.lib
Minimum operating systems Windows 2000
Unicode Implemented as ANSI and Unicode versions.
See Also
Windows Overview, DeregisterShellHookWindow, SetWindowsHookEx, WindowProc, ShellProc, WinEvents, Sending a Message
--------------------------------------------------------------------------------
Declare Function RegisterShellHook Lib "Shell32" Alias "#181" (ByVal hwnd As Long, ByVal nAction As Long) As Long
其中hwnd为窗口句柄,而nAction通常为下面的常数:
Const RSH_DEREGISTER = 0
Const RSH_REGISTER = 1
Const RSH_REGISTER_PROGMAN = 2
Const RSH_REGISTER_TASKMAN = 3
还有个RegisterShellHookWindow也可以,这个函数不需要nAction。
eg:
Option Explicit
Private 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
Private Declare Function RegisterWindowMessage _
Lib "user32" _
Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long
Private Declare Function SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" (ByVal Hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong _
Lib "user32" _
Alias "GetWindowLongA" (ByVal Hwnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function RegisterShellHook _
Lib "Shell32" _
Alias "#181" (ByVal Hwnd As Long, _
ByVal nAction As Long) As Long
Private Declare Function RegisterShellHookWindow _
Lib "user32" (ByVal Hwnd As Long) As Long
Private Declare Function DeregisterShellHookWindow _
Lib "user32" (ByVal Hwnd As Long) As Long
Private Const HSHELL_WINDOWCreateD = 1
Private Const HSHELL_WINDOWDESTROYED = 2
Private Const HSHELL_ACTIVATESHELLWINDOW = 3
Private Const HSHELL_WINDOWACTIVATED = 4
Private Const HSHELL_GETMINRECT = 5
Private Const HSHELL_REDRAW = 6
Private Const HSHELL_TASKMAN = 7
Private Const HSHELL_LANGUAGE = 8
Private Const WM_NCDESTROY = &H82
Private Const GWL_WNDPROC = -4
Private lpPrevWndProc As Long
Private msgShellHook As Long
Public Sub Unhook(Hwnd As Long)
SetWindowLong Hwnd, GWL_WNDPROC, lpPrevWndProc
Call DeregisterShellHookWindow(Hwnd)
End Sub
Public Sub StartHook(Hwnd As Long)
msgShellHook = RegisterWindowMessage("SHELLHOOK")
Dim hLibShell As Long
RegisterShellHookWindow Hwnd
lpPrevWndProc = SetWindowLong(Hwnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Private Function WindowProc(ByVal Hwnd As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Select Case uMsg
Case WM_NCDESTROY
Unhook Hwnd
Case msgShellHook
Select Case wParam
Case HSHELL_WINDOWCreateD
Call AddLog(lParam, "HSHELL_WINDOWCreateD")
Case HSHELL_WINDOWDESTROYED
Call AddLog(lParam, "HSHELL_WINDOWDESTROYED")
Case HSHELL_REDRAW
Call AddLog(lParam, "HSHELL_REDRAW")
Case HSHELL_WINDOWACTIVATED
Call AddLog(lParam, "HSHELL_WINDOWACTIVATED")
Case HSHELL_GETMINRECT
Call AddLog(lParam, "HSHELL_GETMINRECT")
Case HSHELL_REDRAW
Call AddLog(lParam, "HSHELL_REDRAW")
Case HSHELL_TASKMAN
Call AddLog(lParam, "HSHELL_TASKMAN")
Case HSHELL_LANGUAGE
Call AddLog(lParam, "HSHELL_LANGUAGE")
End Select
End Select
WindowProc = CallWindowProc(lpPrevWndProc, Hwnd, uMsg, wParam, lParam)
End Function
发表评论
-
vb 启动外部程序并且模拟鼠标点击
2011-03-09 13:28 1080Imports System.Runtime.InteropS ... -
VB 列出SQL数据库中所有表及字段信息
2011-03-09 13:24 1102程序思想:用Select name From sysobje ... -
VB 纯代码实现Timer控件的功能
2011-03-09 13:23 1246本博客有一篇类似的文章《VB 中运用 TimeSetEvent ... -
VB 控制音量
2011-03-09 13:22 1194'按钮一是音量增加,按钮二是音量减少,按钮三是静音切换. ... -
拦截 VB TextBox 双击消息
2011-03-09 13:22 922我们都知道在VB中TextBox默认是没有双击消息过程的(也就 ... -
VB 获取/设置屏幕分辨率
2011-03-09 13:21 1067Option ExplicitPrivate Decla ... -
VB 将数据快速导入EXCEL
2011-03-09 13:21 991Public Function ToExcel()On ... -
VB 建立快捷方式
2011-03-09 13:20 760Private Declare Function fCr ... -
VB 获取快捷方式原文件路径
2011-03-09 13:20 894'此方法不需要引用IShellLink.Private ... -
VB 的一组字符串转换函数
2011-03-09 13:20 752Public Function chrConvert(s ... -
VB 在浏览目录时指定初始目录
2011-03-09 13:19 972'VB也可以使用CallBack,下面是一个例子: '先 ... -
VB 获得鼠标滚轮的事件
2011-03-09 13:18 946'窗体代码Private Sub Form_Load() ... -
VB 比较两组字符串
2011-03-09 13:18 1237【方法一】 StrComp(string1, Stri ... -
VB 用API下载文件实例
2011-03-09 13:17 771'########################### ... -
VB 窗口处理技巧大全
2011-03-09 13:17 755VB提供了API函数SetWindowLong和GetWind ... -
VB 实现屏幕右下角浮出式消息窗口,透明淡出效果。
2011-03-09 13:16 922'任务栏高度[此部分相关代码转载自 枕善居]Privat ... -
VB Filter 函数用法
2011-03-09 13:16 1898例子1:Dim aa(10) As StringDim bbD ... -
VB 在EXPLORER进程崩溃之后重建托盘图标
2011-03-09 13:15 818重点为:向系统注册“TaskbarCreated”消息 ... -
Shell 调用程序后等待该程序结束后返回继续
2011-03-09 13:15 1191方法1: Private Declare Functi ... -
VB 最简单的WAV声音或音乐文件播放的代码
2011-03-09 13:14 1339'最简单的WAV声音或音乐文件播放的代码'API声明Pr ...
相关推荐
这里也顺便给出常用的WinGW GCC编译器的DLL开发注意事项,及共享段定义的使用方法,这样就可以在CodeBloacks这类使用GCC编译器的IDE正确编译程序。提示一下,MinGW中的文件后缀a表示是一个链接库文件,如MinGW\lib\...
VB 无DLL HOOK 任意函数44147
完整的ring3 hook openprocess 包含 VB 調用例子而且非常穩定
API Hook示例代码:用来将自定义的 Dll 注入进程空间,并钩住指定 API 函数,关于注入和钩 API 的代码,这里主要介绍如何使用这个小工具方便实现截获 API 的功能
Hook keyboard DLL API
vb api 手册,chm版的. 取得Disk Volume Information 显示、隐藏win95任务栏 限制Form Resize的最大值 如何使Mouse的右键无效(Mouse Hook)
VB内嵌汇编实现单个类文件实现子类化钩子.
运用DLL注入 以及API HOOK技术开发的钩子程序,记录IE的联网地址
一个带窗体的DLL注入到游戏中示例源码。 HOOK_DLL!
键盘钩子,截取所有键盘输入的Keydown和Keyup事件
Driver_hook Driver_hook Driver_hook Driver_hook
dll注入后拦截API,修改本程序可以拦截不同的API
首先 注入与HOOK程序代码 需要用到myapi.tlb 文件,请将myapi.tlb文件引用到该工程中.否则无法正常编译
全局键盘钩子,VS2013的项目,可直接编译运行查看键盘消息
hookapi_hook进程_hook_underj5n_apihook_源码.zip
hookapi_hook进程_hook_underj5n_apihook_源码.rar
获取cpuid的dll dll dll
VB - Hook CreateProcessInternalW 实现进程拦截
vb利用opengl,显示在多个图片框里,opengl运算模块,独立建立摄像机类模块