Click here to Skip to main content
15,912,329 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalshortcut using installshield Pin
Anonymous9-Jan-04 12:56
Anonymous9-Jan-04 12:56 
GeneralRe: shortcut using installshield Pin
Stefan Pedersen9-Jan-04 13:53
Stefan Pedersen9-Jan-04 13:53 
GeneralCATEGORYINFO & ICatRegister Pin
suiram409-Jan-04 11:25
suiram409-Jan-04 11:25 
GeneralRe: CATEGORYINFO & ICatRegister Pin
K ARUN KUMAR29-Apr-11 4:09
K ARUN KUMAR29-Apr-11 4:09 
GeneralProblem with VB DLL to use with VC++ Pin
Chirag Chauhan9-Jan-04 10:27
Chirag Chauhan9-Jan-04 10:27 
GeneralRe: Problem with VB DLL to use with VC++ Pin
Stefan Pedersen9-Jan-04 13:59
Stefan Pedersen9-Jan-04 13:59 
GeneralRe: Problem with VB DLL to use with VC++ Pin
Chirag Chauhan9-Jan-04 14:47
Chirag Chauhan9-Jan-04 14:47 
GeneralMouse Hook Problem Pin
Zee man9-Jan-04 9:45
Zee man9-Jan-04 9:45 
Hi All,

I am getting this weird problem for the past 4 days. Anyone seen this before?

I am trying to monitor mouse events on a specific application (Windows XP calculator calc.exe). I have set a hook on the Hwnd pointer of calc using

hook = SetWindowsHookEx(WH_GETMESSAGE,
(HOOKPROC)msghook,
hInst,
GetWindowThreadProcessId(hWnd, NULL));

and then I use the following to detect messages

static LRESULT CALLBACK msghook(UINT nCode, WPARAM wParam, LPARAM lParam)
{
char text[10];
if(nCode < 0)
{ /* pass it on */
CallNextHookEx(hook, nCode, wParam, lParam);
return 0;
} /* pass it on */
LPMSG msg = (LPMSG)lParam;
switch(msg->message)
{
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
PostMessage(hWndServer, UWM_LBUTTONDOWN, WM_LBUTTONDOWN, msg->lParam);
break;
case WM_LBUTTONUP:
case WM_NCLBUTTONUP:
PostMessage(hWndServer, UWM_LBUTTONUP, WM_LBUTTONUP, msg->lParam);
break;
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
PostMessage(hWndServer, UWM_MOUSEMOVE, WM_MOUSEMOVE, msg->lParam);
break;
}
return CallNextHookEx(hook, nCode, wParam, lParam);
}

What happens is that WM_LBUTTONDOWN comes in fine but the WM_LBUTTONUP never comes in, instead a mousemove message shows up (EVEN WHEN THE MOUSE IS NOT MOVING). Its very erratic. Sometimes the WM_LBUTTONUP case does execute but very rarely. Am I doing something wrong?

If I use WH_MOUSE or WH_CBT instead of WH_GETMESSAGE, none of the cases gets called. Has anyone had this kind of problem before.

By the way my mouse is not faulty. I tried this code on a number of PCs with the same result.
Thanks in advance.

Regards,
Zahid
GeneralRe: Mouse Hook Problem Pin
Joel Lucsy12-Jan-04 4:05
Joel Lucsy12-Jan-04 4:05 
GeneralCIntArray in a structure Pin
(Steven Hicks)n+19-Jan-04 9:38
(Steven Hicks)n+19-Jan-04 9:38 
GeneralRe: CIntArray in a structure Pin
Gary R. Wheeler10-Jan-04 9:25
Gary R. Wheeler10-Jan-04 9:25 
QuestionHow to convert CString to int Pin
mr20039-Jan-04 9:11
mr20039-Jan-04 9:11 
AnswerRe: How to convert CString to int Pin
(Steven Hicks)n+19-Jan-04 9:33
(Steven Hicks)n+19-Jan-04 9:33 
AnswerRe: How to convert CString to int Pin
(Steven Hicks)n+19-Jan-04 9:33
(Steven Hicks)n+19-Jan-04 9:33 
AnswerRe: How to convert CString to int Pin
Michael Dunn9-Jan-04 17:07
sitebuilderMichael Dunn9-Jan-04 17:07 
GeneralRe: How to convert CString to int Pin
Jagadeesh VN9-Jan-04 18:19
Jagadeesh VN9-Jan-04 18:19 
GeneralRe: How to convert CString to int Pin
Tim Smith10-Jan-04 4:43
Tim Smith10-Jan-04 4:43 
GeneralRe: How to convert CString to int Pin
Jagadeesh VN11-Jan-04 8:42
Jagadeesh VN11-Jan-04 8:42 
GeneralWindow Background color Pin
yuvald9-Jan-04 8:39
yuvald9-Jan-04 8:39 
GeneralRe: Window Background color Pin
Michael Dunn9-Jan-04 17:09
sitebuilderMichael Dunn9-Jan-04 17:09 
GeneralRe: Window Background color Pin
yuvald9-Jan-04 22:23
yuvald9-Jan-04 22:23 
GeneralRe: Window Background color Pin
Jijo.Raj9-Jan-04 19:06
Jijo.Raj9-Jan-04 19:06 
GeneralRe: Window Background color Pin
yuvald9-Jan-04 22:17
yuvald9-Jan-04 22:17 
Generaladding a C file to a CPP proj Pin
ABean9-Jan-04 8:14
ABean9-Jan-04 8:14 
GeneralRe: adding a C file to a CPP proj Pin
Maximilien9-Jan-04 8:39
Maximilien9-Jan-04 8:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.