Jump to content
  • Advertisement
Sign in to follow this  
shumik

WM_MOUSEMOVE

This topic is 4761 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

WM_MOUSEMOVE can only provide an event where mouse is moved and either shift button pressed or a mouse button clicked at a time. But I need all three: to create an event where Mouse is moved, a mouse button is clicked and a shift is pressed. What should I do? Thanks

Share this post


Link to post
Share on other sites
Advertisement
I think i wasn't very clear to explain what i want. sorry.
I need to be able to do the following:
Suppose there is an object on the screen, I click on it with left mouse button, i press the shift key, and while holding left mouse button and shift key together - i move the mouse, so that a clone of this object is created and dragged. So it's all 3 events together: mouse is moving, button is clicked and a key is pressed. WM_MOUSEMOVE can only give you 2 events: moving mouse and pressing shift, or moving mouse and clicking a mouse button, but not all three at the same time. I need all three of them at the same time.

Share this post


Link to post
Share on other sites
Well, In that case you could do something like this:


WM_LBUTTONDOWN :

bool bool_lbuttondown = TRUE;

....

WM_MOUSEMOVE :

if ( bool_lbuttondown && (wParam == MK_SHIFT) )
// all three events happend

Share this post


Link to post
Share on other sites
Thanks for the hint!
I figured out the problem with the following code

//global variable
bool ShiftLClickDown = false;
LRESULT WINAPI MsgProc(...)
//Buttons DOWN
case WM_LBUTTONDOWN:
{
switch (wParam)
{
case 5: //5 stands for Shift
ShiftLClickDown = true;
break;
//you can add more cases here for CTRL and other buttons

}
break;
}

case WM_MOUSEMOVE:
{
//shift is down + move + lclick
if (ShiftLClickDown)
{
printf("triple event here!\n");
break;
}
....

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!