Thread: checking is mouse button is down

  1. #1
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267

    checking is mouse button is down

    How do i find out whether a mouse button is down or not at any time and not only the moment it's clicked? I tried making a bool variable that get changed to true when the window procedure function is called with WM_LBUTTONDOWN and to false in the case of WM_LBUTTONUP but it wont get the WM_LBUTTONUP message when i bring up a modal dialog box.

    OS: Windows 7, XUbuntu 11.10, Arch Linux
    IDE: CodeBlocks
    Compiler: GCC

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    There's a few other commands you could experiment, ie. MK_LBUTTON and perhaps even WM_MOUSEMOVE might be of some help to you. Too lazy to find you a link, but check MSDN. Or, if you're even lazier than I am, maybe someone else will throw you the answer!

  3. #3
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    i read the msdn page for WM_LBUTTONDOWN and WM_MOUSEMOVE...
    so it's one of the possible wParam values whenever theres a mouse action message?

    is there an alternative solution to this that i can use outside the window procedure?

    OS: Windows 7, XUbuntu 11.10, Arch Linux
    IDE: CodeBlocks
    Compiler: GCC

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    I don't understand what your problem is. You want to read WM_LBUTTONUP and WM_LBUTTONDOWN messages in a dialog box? Why not subclass the dialog box callback procedure (by writing your own and replacing yours with the former)?

    General information on mouse input:

    http://msdn2.microsoft.com/en-us/library/ms674719.aspx

  5. #5
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    no, the problem is if a modal dialog box comes up while the mouse button is down, i don't get a WM_LBUTTONUP message

    OS: Windows 7, XUbuntu 11.10, Arch Linux
    IDE: CodeBlocks
    Compiler: GCC

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 12
    Last Post: 12-08-2008, 07:13 PM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. Problems about gcc installation
    By kevin_cat in forum Linux Programming
    Replies: 4
    Last Post: 08-09-2005, 09:05 AM
  4. Making a mouse hover button, API style
    By hanhao in forum C++ Programming
    Replies: 1
    Last Post: 05-27-2004, 06:17 AM
  5. Checking if the mouse is over a button
    By pinkcheese in forum Windows Programming
    Replies: 6
    Last Post: 04-21-2002, 10:31 PM