CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    9

    Getting mouse position if within a control

    I have a dialog application. OnMouseMove is called anytime the mouse is within the dialog (client area). However, there is no mouse position when my cursor is over a pushbutton. I want something to happen when the cursor is over the pushbutton. The cursor position is present throughout the dialog box but it seems that OnMouseMove is not active while over a control. Any suggestions on how to know if the mouse is over a control? Thank you.


  2. #2
    Join Date
    Apr 1999
    Location
    Frankfurt, Germany
    Posts
    113

    Re: Getting mouse position if within a control

    Hi,
    the mouse move message is always sent to the window (here dialog / control) the mouse is over, i.e. Your control gets the message and not the dialog. To follow the mouse, i can see two possibilities:
    1) You can overwrite OnMouseMove for all of Your controls.
    2) You can call SetCapture for Your dialog class. In this case all mouse messages are sent to Your dialog. So You can see, in which control the mouse is. But if You want in this case Your controls to accept clicks etc., You have to sent the messages there Yourself.
    Possibly there are better possibilities, but if I don't know them myself...
    HTH
    Rudolf


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured