QUOTE (rpodsim @ Jan 29 2009, 10:54 PM)
Does someone fixed that prob? I tried to catch the WM_MOVING message but I cant receive it. I've tried something like that:
#include "stdafx.h"#include "extcode.h"</P> <P>HHOOK hWndProc;</P> <P>BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ){switch (ul_reason_for_call){case DLL_PROCESS_ATTACH: hWndProc = NULL; break; case DLL_THREAD_ATTACH:case DLL_THREAD_DETACH:case DLL_PROCESS_DETACH: if(hWndProc != NULL) UnhookWindowsHookEx(hWndProc); break;}return TRUE;}</P> <P>// Prototypesextern "C" __declspec(dllexport) int CatchWindowMessage(LVRefNum *ptargetWnd);LRESULT WINAPI WndProc(int nCode, WPARAM wParam, LPARAM lParam);</P> <P>extern "C" __declspec(dllexport) int CatchWindowMessage(LVRefNum *ptargetWnd){ HWND LVhWnd = (HWND)(*ptargetWnd); DWORD targetThread = GetWindowThreadProcessId(LVhWnd, NULL); hWndProc = SetWindowsHookEx(WH_GETMESSAGE, &WndProc, NULL, targetThread); return 0;}</P> <P>/**************************************************************** WH_GETMESSAGE hook procedure ****************************************************************/ </P> <P>LRESULT WINAPI WndProc(int nCode, WPARAM wParam, LPARAM lParam) {MSG *msg = (MSG*)lParam;</P> <P>if (nCode < 0) // do not process message return CallNextHookEx(hWndProc, nCode, wParam, lParam); switch (nCode) { case HC_ACTION:switch(msg->message){case WM_MOVING:MessageBox(NULL, "Wnd moving", "WM Info", MB_OK);</P> <P> default:break;} return CallNextHookEx(hWndProc, nCode, wParam, lParam); }
Unfortunately I can't catch WM_MOWING like I tried to do.
Best regards and sorry about my english.