Re: help with WM_LBUTTONDOWN
I have noticed that it does not work if you are capturing event on the control. However, I can capture the event when I try to detect mouse click on the dialog. What actually you wish to do?
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by zawthet
I have noticed that it does not work if you are capturing event on the control. However, I can capture the event when I try to detect mouse click on the dialog. What actually you wish to do?
Actually, the user will be using the IE. I have to save the position of his clicks. so he will be clicking on the microsoft activex control :(
Is that not feasible ??
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by llp00na
Now i am printing some stuff within the event handler of WM_LBUTTONDOWN. however, nothing happens.
What exactly do you mean by "printing some stuff"? And: Where are you handling the WM_LBUTTONDOWN message? In a class derived from the browser control, or in the containing window? From what you posted, you are handling it in the (CWinApp-derived) application class - this won't work, since it's not a window.[/QUOTE]
1 Attachment(s)
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by gstercken
What exactly do you mean by "printing some stuff"? And: Where are you handling the WM_LBUTTONDOWN message? In a class derived from the browser control, or in the containing window? From what you posted, you are handling it in the (CWinApp-derived) application class - this won't work, since it's not a window.
[/QUOTE]
I have added the WM_LBUTTONDOWN message to the main dialog window.
Please have a look at the attachment.
Re: help with WM_LBUTTONDOWN
does nobody knwo how to solve this problem ???
Re: help with WM_LBUTTONDOWN
Simple Perform Hooking On your Mouse.
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by humptydumpty
Simple Perform Hooking On your Mouse.
i have no previous knowledge about hooking. I have been looking at some articles and it looked too complicated for me (i am very notice to visual c++).
If WM_LBUTTONDOWN is a possible solution, i would prefer to do it this way. else or i will find myself obliged to do it the hard way (mouse hook).
Re: help with WM_LBUTTONDOWN
See Hooking is not That Much a hard task
you have to perform following step .details you can found in MSDN if still Problem Let us Know
1)use SetWindowsHookEx() for installing the hook in your Application
2)define your Callback procedure now
3)use UnhookWindowsHookEx() function to unhook your Window
a idea
Code:
::SetWindowsHookEx(WH_MOUSE,GetMessageProc,....,.......); //Sets the hook on your mouse
::UnhookWindowsHookEx(HHOOK hhk)//after finishing your work unhook it
Code:
//Now write your Procedure
GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam)
{
//write your code here
// Passes the hook information to the next hook procedure in
// the current hook chain.
return ::CallNextHookEx(m_hHook, nCode, wParam, lParam);
}
thankyou
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by humptydumpty
See Hooking is not That Much a hard task
you have to perform following step .details you can found in MSDN if still Problem Let us Know
1)use SetWindowsHookEx() for installing the hook in your Application
2)define your Callback procedure now
3)use UnhookWindowsHookEx() function to unhook your Window
a idea
Code:
::SetWindowsHookEx(WH_MOUSE,GetMessageProc,....,.......); //Sets the hook on your mouse
::UnhookWindowsHookEx(HHOOK hhk)//after finishing your work unhook it
Code:
//Now write your Procedure
GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam)
{
//write your code here
// Passes the hook information to the next hook procedure in
// the current hook chain.
return ::CallNextHookEx(m_hHook, nCode, wParam, lParam);
}
thankyou
is there any need to use a dll. and when do i exactly need to use global hook functions.
In my application i will need to record user left clicks on the microsoft activex control. would your approach described above be sufficient
Re: help with WM_LBUTTONDOWN
dll for wat ?
and all above is only a idea to show you that you don't have to take a lot of burden in case of hooking. in case of GetMessageProc() simply do what ever you want.
Just Read Once Again in MSDN.
Okay .
if Still Problem Let us know.So i will Send you a sample workspace .
Thankyou
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by humptydumpty
dll for wat ?
and all above is only a idea to show you that you don't have to take a lot of burden in case of hooking. in case of GetMessageProc() simply do what ever you want.
Just Read Once Again in MSDN.
Okay .
if Still Problem Let us know.So i will Send you a sample workspace .
Thankyou
the reason why i mentioned a dll,
MSDN**
You must place a global hook procedure in a dynamic-link library (DLL) separate from the application installing the hook procedure**
Re: help with WM_LBUTTONDOWN
Forget about hooking, it's unnecessary. :)
Code:
BOOL CPilotStudyDlg::PreTranslateMessage(MSG* pMsg)
{
if(WM_LBUTTONDOWN == pMsg->message)
{
fprintf(trial, "\nMouse: x = %i, y = %i ", LOWORD(pMsg->lParam), HIWORD(pMsg->lParam));
fflush(trial);
}
return CDialog::PreTranslateMessage(pMsg);
}
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by Igor Vartanov
Forget about hooking, it's unnecessary. :)
Code:
BOOL CPilotStudyDlg::PreTranslateMessage(MSG* pMsg)
{
if(WM_LBUTTONDOWN == pMsg->message)
{
fprintf(trial, "\nMouse: x = %i, y = %i ", LOWORD(pMsg->lParam), HIWORD(pMsg->lParam));
fflush(trial);
}
return CDialog::PreTranslateMessage(pMsg);
}
Thanx very much,
your code really helped alot. is there any downsides with using this approach ?
you have saved me lots of troubles. I am very grateful.
Thank you
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by Igor Vartanov
Forget about hooking, it's unnecessary. :)
Code:
BOOL CPilotStudyDlg::PreTranslateMessage(MSG* pMsg)
{
if(WM_LBUTTONDOWN == pMsg->message)
{
fprintf(trial, "\nMouse: x = %i, y = %i ", LOWORD(pMsg->lParam), HIWORD(pMsg->lParam));
fflush(trial);
}
return CDialog::PreTranslateMessage(pMsg);
}
I have got one slight problem. I have noticed that when i click next to the address bar (on Url Address text ) i receive a value for *y* that is bigger than the value of *y* received when clicking on the microsoft control (just below the area where the control and the dialog meets). In fact, y values should increase as i go away from top to bottom.
Do you have any explanation for that ?