Hi all,
i have hooked into an external applications messages and i want to post a message to my own user message to the bottom of the message queue. However the message whilst postmessage returns a number (i.e. its successful) the message isn't getting posted.
i create my hook like so;
with my callback proc beingCode:appHook = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)AppEventsHook, hinstDLL, GetWindowThreadProcessId(GetAppWnd(), NULL));
ok now i have hooked into the right window i can read all events such as WM_WINDOWPOSCHANGING etc. I have also tried posting a user message like so i.e.Code:const static UINT WM_PRIVATE_MSG = RegisterWindowMessage("WM_PRIVATE_MSG"); LRESULT CALLBACK AppEventsHook (int nCode, WPARAM wParam, LPARAM lParam) { try { if(nCode == HC_ACTION) { LPCWPSTRUCT pCwp = (LPCWPSTRUCT) lParam; if(pCwp->message == WM_PRIVATE_MSG) { MessageBox(0, "Received message!", "Got it!", MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL); } switch(pCwp->message) { case WM_WINDOWPOSCHANGED: {PostMessage(pCwp->hwnd,WM_PRIVATE_MSG,NULL,NULL); } } return CallNextHookEx(appHook,nCode,wParam,lParam);
and trying to catch this in the switch statement. Again ith no luck.Code:PostMessage(pCwp->hwnd, WM_USER+10,0,0);
I'm running on Windows server 2003 coudl this make a difference?
any ideas?
many thanks,
matt.


Reply With Quote