#ifndef _HOOKPROC_MESSAGEHOOK_HPP_ #define _HOOKPROC_MESSAGEHOOK_HPP_ #ifndef _HOOKPROC_APIENTRY_HPP_ #include #endif #ifndef _HOOKPROC_PROCADDRESS_HPP_ #include #endif class MsgHook; typedef ProcAddress MessageHook; class MsgHook : protected APIEntry, private MessageHook { public: MsgHook(void); virtual ~MsgHook(); protected: virtual int hookProc(int code,WPARAM wParam,LPARAM lParam); private: enum {ParamLength=12}; MsgHook &operator=(const MsgHook &someMsgHook); int entryProc(int code,WPARAM wParam,LPARAM lParam); HHOOK mhPrevHook; }; inline MsgHook::MsgHook(void) : APIEntry(ParamLength,(DWORD)this,getProcAddress((ProcAddress::LPFNMETHODVOID)&MsgHook::entryProc)), mhPrevHook(0) { mhPrevHook=::SetWindowsHookEx(WH_GETMESSAGE,(HOOKPROC)codeBase(),(HINSTANCE)::GetModuleHandle(0),::GetCurrentThreadId()); } inline MsgHook &MsgHook::operator=(const MsgHook &someMsgHook) { // no implementation return *this; } #endif