Thread: Code for holding down right mouse button

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    64

    Code for holding down right mouse button

    Hello all,

    I just have a quick question: how do you check in your window function if the right mouse button is being held down? The only solution I can come up with is as follows:

    Code:
    case WM_MOUSEMOVE:
    if(wParam &MK_RBUTTON)
    //do what you have to
    break;
    The only problem with this is that it only responds when the mouse moves (as it should). Is there any other way to check if the right mouse button being pressed (perhaps in a WM_TIMER message)? Many thanks in advance.

    Best,

    Bill

  2. #2
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    idk if this helps, but you can always have a static bool variable that is set to true when the right button is down and set to false when its let up in the WM_RBUTTONDOWN and WM_RBUTTONUP messsages.
    My Website
    010000110010101100101011
    Add Color To Your Code!

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    64
    Thank you oh so dearly. It really helped.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simulate Left Mouse Button (VK_LBUTTON)
    By guitarist809 in forum Windows Programming
    Replies: 3
    Last Post: 04-19-2008, 06:05 PM
  2. checking is mouse button is down
    By h_howee in forum Windows Programming
    Replies: 4
    Last Post: 06-30-2007, 10:14 PM
  3. Looking at current mouse button state
    By Lifedragn in forum C# Programming
    Replies: 4
    Last Post: 12-02-2005, 06:52 AM
  4. Seems like correct code, but results are not right...
    By OmniMirror in forum C Programming
    Replies: 4
    Last Post: 02-13-2003, 01:33 PM
  5. Mouse button outside of my app?
    By BubbleMan in forum Windows Programming
    Replies: 1
    Last Post: 10-01-2001, 03:33 AM