-
-
[求助]HOOK的问题,大家帮忙看看
-
发表于:
2013-7-29 11:19
3695
-
// 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消息,是什么原因哦
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课