|
Superman:
I respectfully disagree.
quote: "The messages for keystrokes are WM_KEYDOWN and WM_KEYUP
These are directed to the parent dialog containing the control."
Unless dialog does not contain any controls, dialog window never gets focus, hence WN_KEYDOWN and WM_KEYUP messages are not sent to a dialog.
quote: "and then subclass the control from the InitDialog function of the dialog class using the SubclassDlgItem method."
It is possible to use SubclassDlgItem or SubclassWindow but it would be much easier to let the wizard do subclassing, by simply add variable of the CRichEditCtrl and later replace it with the derived class type.
ForNow:
Depending what is exactly you are trying to achieve, I think the best way to handle special keys is creating accelerators and add handlers to a CRichEditCtrl derived class.
JohnCz
|
|
|
|
|
how about using virtual ::PretranslateMessage
|
|
|
|
|
Hi...
I am working on image quality metrics and i have found that edge stability measure can be used to evaluate different edge detectors according to a paper "statistical evaluation of image quality measures". I am finding it difficult to implement this metric. So can anyone help me or suggest ideas to implement it.
Regards,
Mamatha E
|
|
|
|
|
Hello Friends
OnMouseMove ,After drawing some color stripes,I am using SetCursorPos(x,y) to Set MousePosition manually at end of stripe.
But As I move Only once after that mouse keeps on moving by itself until I dont release mouse lbutton up.
I am assuming that setCursorPos is calling MouseMove so it is going in Infinite Loop.
But,In actual I want to stop mouse pos at end of stripe while mouseMove.
Here is the Flow :
1.)LButtonDown
2.)MouseMove(drawing stripe then setCursorPos() calling) [want mouse cursor at end of stripe]
And again if Mousemove,strip should draw and cursor at end of Stripe.
3.)LbuttonUp[releasing the mouse]
Any Ideas??
Regards
Yogesh
modified 24-May-12 8:41am.
|
|
|
|
|
Just remember in a "global" variable that you have done the movement so that you can then ignore OnMouseOver the next time.
|
|
|
|
|
If you're drawing in MouseMove , why do you need to call SetCursorPos .
Please post some relevant code so that we can understand the problem better.
|
|
|
|
|
Hello
As I told that OnMouseMove I am drawin gsome color stripes on Ruler Scale .
Suppose scale is from 1 to 10 and If i am clicked on 2 and moved a little then it draws stripe of 5inch width.after that i want cursor should come at 7th Inch. So,for that i used SetCursorpos to move mouse manually after end of drawn stripe.
Any IDeas ?
Regards
Yogesh
|
|
|
|
|
The question is not clear to me, but let me answer with what I think the question is.
An OnMouseMove handler is called when the mouse is moved over a window.
When SetCursorPos is called, it does not normally call OnMouseMove .
But if the new cursor position as a result of calling SetCursorPos is over the window for which the OnMouseMove handler is created, then it will be invoked.
If that is the case, you will need to set a flag before calling SetCursorPos and then check this flag inside OnMouseMove to distinguish between manually moving the mouse and calling SetCursorPos .
Remember to reset this flag inside OnMouseMove .
|
|
|
|
|
Hello
you got it right.
I am facing the same scenario.
Let me try your way.
Thanks & Regards
Yogesh
|
|
|
|
|
Hello
As U suggested that I need to set a flag before calling setCursorPos to check on MouseMove. Suppose If this flag satisfies the condition on MouseMove that movement is through SeCursorPos then it will return from there and then how will i reset tht flag on MouseMove.
Here is sample Code for this:
void CMarkWnd::OnMouseMove(UINT nFlags, CPoint point)
{
if(GetCapture() != this) return;
SetCursorPos(x,y)
CWnd::OnMouseMove(nFlags, point);
}
Thanks
Yogesh
|
|
|
|
|
Please check the lines in bold.
That should do it.
void CMarkWnd::OnMouseMove(UINT nFlags, CPoint point)
{
if (mouseFlag)
{
mouseFlag = false;
return;
}
if(GetCapture() != this) return;
mouseFlag = true;
SetCursorPos(x,y)
CWnd::OnMouseMove(nFlags, point);
}
|
|
|
|
|
Hello.
I tried as u suggested but still Mouse is keep on Moving on my First move.
Thanks
Yogesh
|
|
|
|
|
Try to debug and find out what is happening.
|
|
|
|
|
I got it. Its Working now.
Thanks Sir ji.
Thanks David For your Info also.I will try your way too.
Regards
Yogesh
|
|
|
|
|
Hi,
Rather than using SetCursorPos you could use the SendInput function[^]. This would allow you to set some 'extra info' for marking simulated user input.
For example:
BOOL setcursorposition(long x, long y)
{
INPUT input = {0};
input.type = INPUT_MOUSE;
input.mi.dx = ((x - GetSystemMetrics(SM_XVIRTUALSCREEN)) * 65535) / (GetSystemMetrics(SM_CXVIRTUALSCREEN)-1);
input.mi.dy = ((y - GetSystemMetrics(SM_YVIRTUALSCREEN)) * 65535) / (GetSystemMetrics(SM_CYVIRTUALSCREEN)-1);
input.mi.dwFlags = MOUSEEVENTF_VIRTUALDESK | MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
input.mi.dwExtraInfo = 0xC0DEDBAD;
return SendInput(1, &input, sizeof(input));
}
void YourClass::OnMouseMove(UINT nFlags, CPoint point)
{
if(0xC0DEDBAD != GetMessageExtraInfo())
{
}
YourBaseClass::OnMouseMove(nFlags, point);
}
Don't forget to convert client coordinates to screen before calling setcursorposition.
Best Wishes,
-David Delaune
|
|
|
|
|
This is definitely the best approach.
I wish I could rate your post.
JohnCz
|
|
|
|
|
I have to Write Program code in C++ for car Parking system using queues ,In which any VIP car is given Priority,The code should contain some simple graphics also..
|
|
|
|
|
|
Listen here you.
This is the third time I have seen this 'question' posted.
You have not received any answers yet because you refuse to observe the forum guidelines. You will continue to receive no help until your method of enquiry improves.
Some suggestions:
1. Work out what you're trying to do
2. Work out how you intend to do this
3. Implement this plan in code.
You should NOT post a question on CodeProject when it relates to point 1.
Questions that ask about how to realize point 3 will be most favourably answered.
My 1
Consider the following contrived questions:
Q1: "I have to build a shed, with a window and shelves. It should not be very basic."
Q2: "I am building a shed with shelves. I have selected part# XXX to fix the shelves to the wall. I am having trouble attaching this part to the walls with nails. I am trying YYY, is this the correct way to use part XXX?
Is there a better way for me to attach the shelves to the walls?"
|
|
|
|
|
ok leaving this forum,i dont have time to read the guidelines,,,i need urgent help,which is not seen yet in this forum..
|
|
|
|
|
Good!
If your Lordship had taken time to read the guidelines, he would have realized that this forum does NOT supply 'urgent help'
Thanks for giving us the chance to ensure your precious time wasn't wasted, it's always a pleasure serving ingrates..
|
|
|
|
|
Sorry, I'm firmly contrary to giving higher priority to VIP cars.
Veni, vidi, vici.
|
|
|
|
|
|
Bad boy.
Veni, vidi, vici.
|
|
|
|
|
You forgot urinating on the door handles. Always makes me laugh!
==============================
Nothing to say.
|
|
|
|