资源简介
如何HOOK桌面窗口消息.
截获桌面窗口鼠标单击事件,解析所选中的桌面 Item,并将解析后的 item 信息发送给主调程序,并将信息显示在一个窗口上面
代码片段和文件信息
#include “CommonDef.h“
#include “DesktopHook.h“
#include “FloatWin.h“
const UINT WM_DESKTOP_CLICKED_ITEM = RegisterWindowMessage(L“WM_DESKTOP_CLICKED_ITEM“);
BOOL g_isCaptured = FALSE;
CFloatWin* g_floatWin = NULL;
INT_PTR WINAPI DlgProc(HWND hwnd UINT uMsg WPARAM wParam LPARAM lParam) ;
int WINAPI _tWinMain(HINSTANCE hinstExe HINSTANCE PTSTR pszCmdLine int)
{
HWND hwnd = FindWindow(TEXT(“#32770“) TEXT(“DesktopCaptor2“));
if (IsWindow(hwnd))
{
// An instance is already running show a messagebox
MessageBox(GetForegroundWindow() L“An instance is already running“ L“Error“ MB_IConerror);
}
else
{
DialogBox(hinstExe MAKEINTRESOURCE(IDD_DESKTOP_CAPTOR) NULL DlgProc);
}
return(0);
}
INT_PTR CALLBACK DlgProc(HWND hDlg UINT message WPARAM wParam LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
{
// Set icon for the application
SendMessage(hDlg WM_SETICON ICON_BIG (LPARAM)
LoadIcon((HINSTANCE) GetWindowLongPtr(hDlg GWLP_HINSTANCE)
MAKEINTRESOURCE(IDI_DESKTOPCAPTOR2)));
// Set dialog‘s position
int nScreenWidth = ::GetSystemMetrics(SM_CXSCREEN);
int nScreenHeight = ::GetSystemMetrics(SM_CYSCREEN);
RECT rect = { 0 };
GetWindowRect(hDlg &rect);
SetWindowPos(
hDlg
HWND_TOP
nScreenWidth - (rect.right - rect.left)
0
0 0
SWP_NOSIZE);
g_floatWin = CFloatWin::getInstance();
}
return (INT_PTR)TRUE;
case WM_COMMAND:
{
UINT wmId = LOWORD(wParam);
UINT wmEvent = HIWORD(wParam);
switch (wmId)
{
case IDOK:
case IDCANCEL:
EndDialog(hDlg LOWORD(wParam));
return (INT_PTR)TRUE;
case IDC_START_CAPTOR:
if (FALSE == g_isCaptured)
{
g_isCaptured = CreateDesktopEventCaptor(hDlg);
}
break;
case IDC_STOP_CAPTOR:
if (TRUE == g_isCaptured)
{
CloseDesktopEventCaptor();
g_isCaptured = FALSE;
}
break;
default:
return DefWindowProc(hDlg message wParam lParam);
}
}
break;
case WM_COPYDATA:
{
COPYDATASTRUCT* pCopyData = (COPYDATASTRUCT*)lParam;
if (pCopyData->dwData == WM_DESKTOP_CLICKED_ITEM)
{
DesktopItemData itemData(*(DesktopItemData*)pCopyData->lpData);
g_floatWin->ShowWindow(TRUE &itemData);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-07-17 01:57 DesktopCaptor\
目录 0 2011-07-17 01:57 DesktopCaptor\Debug\
文件 199168 2011-07-17 01:56 DesktopCaptor\Debug\DesktopCaptor2.exe
文件 53760 2011-07-17 01:56 DesktopCaptor\Debug\DesktopHook.dll
文件 1534 2011-07-15 17:13 DesktopCaptor\DesktopCaptor.sln
文件 8192 2011-07-17 01:57 DesktopCaptor\DesktopCaptor.suo
目录 0 2011-07-17 01:57 DesktopCaptor\DesktopCaptor2\
文件 1309 2011-07-11 04:28 DesktopCaptor\DesktopCaptor2\CommonDef.h
文件 3046 2011-07-15 17:16 DesktopCaptor\DesktopCaptor2\DesktopCaptor2.cpp
文件 127493 2009-06-23 14:57 DesktopCaptor\DesktopCaptor2\DesktopCaptor2.ico
文件 2952 2011-07-11 05:28 DesktopCaptor\DesktopCaptor2\DesktopCaptor2.rc
文件 4399 2011-07-11 05:28 DesktopCaptor\DesktopCaptor2\DesktopCaptor2.vcproj
文件 3107 2011-07-11 07:38 DesktopCaptor\DesktopCaptor2\FloatWin.cpp
文件 581 2011-07-11 07:39 DesktopCaptor\DesktopCaptor2\FloatWin.h
文件 595 2011-07-11 05:22 DesktopCaptor\DesktopCaptor2\resource.h
目录 0 2011-07-17 01:57 DesktopCaptor\DesktopHook\
文件 6201 2011-07-17 00:13 DesktopCaptor\DesktopHook\DesktopHook.cpp
文件 143 2011-07-10 19:49 DesktopCaptor\DesktopHook\DesktopHook.def
文件 1754 2011-07-15 17:21 DesktopCaptor\DesktopHook\DesktopHook.h
文件 5324 2011-07-15 18:09 DesktopCaptor\DesktopHook\DesktopHook.vcproj
文件 2530 2011-07-15 18:09 DesktopCaptor\DesktopHook\DesktopItem.cpp
文件 978 2011-07-11 02:07 DesktopCaptor\DesktopHook\DesktopItem.h
文件 464 2011-07-10 20:29 DesktopCaptor\DesktopHook\dllmain.cpp
文件 1779 2011-07-10 16:51 DesktopCaptor\DesktopHook\ReadMe.txt
文件 298 2011-07-10 16:51 DesktopCaptor\DesktopHook\stdafx.cpp
文件 664 2011-07-11 01:32 DesktopCaptor\DesktopHook\stdafx.h
文件 1428 2011-07-10 16:51 DesktopCaptor\DesktopHook\targetver.h
- 上一篇:利用钩子技术控制进程创建(源码)
- 下一篇:驱动和应用层的三种通信方式
相关资源
- DLL注入HOOK进程按钮点击delphi
- hook wmi 修改机器码
- dll注入Hook
- easyhook库的使用
- SetWindowsHookEx Hook demo
- 拦截网络socket的数据
- Hook工具 监控任意窗体拦截消息
- HookNtQuery_File.zip
- 内存注入(IAT Hook 和Inline Hook)
- HOOK API 完美支持 x86 x64
- HookdiskID_硬盘ID修改 程序
- D3D8 hook 游戏屏幕写入文字
- HOOK截取封包.rar易语言源码
- HOOK API源码 (OPENPROCESS)
- 老外写的sockethook代码 实现socket钩子
- 微信hock源码
- svn hooks 全集,包含常用
- CEFGlue 加载FLASH 使用easyhook 解决 CEF
- X64 inline hook CreateProcessInternalW
- HookCreateProcess
- 基于API-HOOK的数据文件透明加解密系统
- Easyhook教程
- e语言-阿里旺旺客户端HOOK监控消息源
- 易语言的DX11 HOOK
- QT后台监控鼠标侧键
- pyHook-1.5.1-cp37-cp37m-win_amd64.whl
- 易语言 拦截文件读写 APIhook
- SystemHooksCompiledOnly
- API hook详解
- VC用HOOK拦截数据包的
评论
共有 条评论