Thread: erratic behavior with mouse messages

  1. #1
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401

    erratic behavior with mouse messages

    im having problems with properly catching mouse click messages, eg WM_RBUTTONUP and WM_RBUTTONDOWN. for example, when you simply click a mouse button, the appropriate mouse button up code is not called. to make it call, you either have to double click, or press it down, move the mouse a small distance, and release. (all this is without any other mouse capture code, just WM_RBUTTONUP). I am mystified as to why this is occurring. has any body got any ideas about this?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #2
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    i just found something interesting with spy++. right after the WM_RBUTTONDOWN message, a WM_CAPTURECHANGED message sends and returns. i looked it up, and i have been trying to use ReleaseCapture() to reverse whatever is happening, but it isnt working.

    just thought that may be useful.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    i found out the relevance of the WM_CAPTURECHANGED message. here is a crappy diagram of the message sequence:

    Code:
    WM_RBUTTONDOWN
        S WM_CAPTURECHANGED
        R WM_CAPTURECHANGED
        WM_MOUSEMOVE (single message)
    WM_RBUTTONUP
    S WM_CAPTURECHANGED
    R WM_CAPTURECHANGED
    the above diagram describes an instance where the code is not captured.

    the next diagram shows the sequence of messages when the mouse is dragged a bit, thus, when the code captures effectively.

    Code:
    WM_RBUTTONDOWN
         S WM_CAPTURECHANGED
         R WM_CAPTURECHANGED
         WM_MOUSEMOVE (multiple messages)
         S WM_CAPTURECHANGED
         R WM_CAPTURECHANGED
         WM_MOUSEMOVE (multiple messages)
    WM_RBUTTONUP
    clearly, you have to wait for the second set of WM_CAPTURECHANGED messages before releasing the mouse button, but why? and how do you stop this happening?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Spy++ view messages posted/sent to a control, or from it?
    By hanhao in forum Windows Programming
    Replies: 2
    Last Post: 06-24-2007, 11:07 PM
  2. Problem in mouse position
    By Arangol in forum Game Programming
    Replies: 6
    Last Post: 08-08-2006, 07:07 AM
  3. mouse messages, painting, tabs
    By ZeroG in forum Windows Programming
    Replies: 0
    Last Post: 06-20-2005, 03:51 AM
  4. Mouse Messages
    By Anglos in forum Windows Programming
    Replies: 2
    Last Post: 06-05-2003, 10:51 AM
  5. Mouse in 800x600 24Bit Mode?
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 11-11-2001, 01:38 AM