-
-
[求助]HOOK的问题,大家帮忙看看
-
发表于:
2013-7-29 11:19
3685
-
// wndWatch.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include "wndWatch.h"
#include <windows.h>
extern HHOOK hhook;
extern HMODULE module;
extern HWND ghwnd;
#define WW_CREATE WM_USER+100
#define WW_DESTORY WM_USER+101
static UINT WM_SHELLHOOKMESSAGE;
LRESULT CALLBACK HookProc(int code,WPARAM wparam,LPARAM lparam)
{
switch (code)
{
case HSHELL_WINDOWCREATED:
PostMessageA(ghwnd,WW_CREATE,wparam,lparam);
break;
case HSHELL_WINDOWDESTROYED:
PostMessageA(ghwnd,WW_DESTORY,wparam,lparam);
break;
}
return CallNextHookEx(hhook,code,wparam,lparam);
}
BOOL WINAPI Start(HWND hwnd)
{
ghwnd = hwnd;
hhook=::SetWindowsHookEx(WH_SHELL,HookProc,module,0);
return (hhook!=NULL);
}
void WINAPI Stop()
{
::UnhookWindowsHookEx (hhook);
}
#ifndef DYNAMIC
#define DYNAMIC
extern "C" __declspec(dllexport) BOOL WINAPI Start(HWND);
extern "C" __declspec(dllexport) void WINAPI Stop();
#endif
大家帮忙看看,为什么只能捕获到HSHELL_REDRAW消息,是什么原因哦
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!