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 ?
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by llp00na
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 ?
Sure I have. The coordinates arrived are client area related. If you wanna get them in some other system, you have to remap them from original recipient window to desired window (MapWindowPoints). The marginal case is client-to-screen remapping (ClientToScreen).
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by Igor Vartanov
Sure I have. The coordinates arrived are client area related. If you wanna get them in some other system, you have to remap them from original recipient window to desired window (
MapWindowPoints). The marginal case is client-to-screen remapping (
ClientToScreen).
Thanx for your reply,
is it possible to detect those clicks on the client area (excluding the control) and ignore them. Because i am only interested in those clicks that happen within the activex control.
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by Igor Vartanov
Sure I have. The coordinates arrived are client area related. If you wanna get them in some other system, you have to remap them from original recipient window to desired window (
MapWindowPoints). The marginal case is client-to-screen remapping (
ClientToScreen).
oh i forgot to ask you. You said, *The coordinates arrived are client area related*. In that case why do i get different results for the coordinates. It does not look like the coordinates are being mapped to the same reference point (being the right top corner of the screen). Instead they are mapped to TWO different references (sometimes the top right corner of the client area and the other time to the top right corner of the control) !!!
i dont mind which reference they use as long as they use only one but not both.
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by llp00na
Thanx for your reply,
is it possible to detect those clicks on the client area (excluding the control) and ignore them. Because i am only interested in those clicks that happen within the activex control.
Well, never could be a problem. :)
BTW, when I wanna watch live XY changes I use caption text for this. :wave:
Code:
BOOL CPilotStudyDlg::PreTranslateMessage(MSG* pMsg)
{
if( WM_LBUTTONDOWN == pMsg->message)
{
TCHAR name[128] = {0};
GetClassName(pMsg->hwnd, name, 128);
if(0 == lstrcmp(name, "Internet Explorer_Server"))
{
CString s;
s.Format("Mouse: x = %i, y = %i\n", LOWORD(pMsg->lParam), HIWORD(pMsg->lParam));
SetWindowText(s);
fprintf(trial, (LPCTSTR)s);
fflush(trial);
}
else
{
SetWindowText(_T("Not IE window"));
}
}
return CDialog::PreTranslateMessage(pMsg);
}
Re: help with WM_LBUTTONDOWN
Quote:
Originally Posted by Igor Vartanov
Well, never could be a problem. :)
BTW, when I wanna watch live XY changes I use caption text for this. :wave:
Code:
BOOL CPilotStudyDlg::PreTranslateMessage(MSG* pMsg)
{
if( WM_LBUTTONDOWN == pMsg->message)
{
TCHAR name[128] = {0};
GetClassName(pMsg->hwnd, name, 128);
if(0 == lstrcmp(name, "Internet Explorer_Server"))
{
CString s;
s.Format("Mouse: x = %i, y = %i\n", LOWORD(pMsg->lParam), HIWORD(pMsg->lParam));
SetWindowText(s);
fprintf(trial, (LPCTSTR)s);
fflush(trial);
}
else
{
SetWindowText(_T("Not IE window"));
}
}
return CDialog::PreTranslateMessage(pMsg);
}
Oh man,
Thanx very much, that saved me alot of troubles. I really appreciate your help.
I was trying to do the mouse hooking stuff because i thought your way wont get me any results. But you proved me wrong, yet an innovative idea that i failed to think of. I am impressed my friend :-)
Thanx alot once again
Re: help with WM_LBUTTONDOWN
You're welcome. :)
BTW, even if you succeeded with hooking, anyway you were facing with the necessity of distinguishing child windows.