CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2005
    Posts
    23

    MFC Event Message Problem

    Hello.

    I am trying to write a simple MFC program to show the current cursor position. I am using OnMouseMove() to do this right now but it is only giving me the postion of the cursor when it is over the window. Is there a function that will pass a message when the mouse moves anywhere on the screen? Is there a way for me to define a custom event? I welcome any information or pointers to other resources. Thanks.

  2. #2
    Join Date
    Oct 2005
    Location
    Bangalore
    Posts
    1,051

    Re: MFC Event Message Problem

    i think GetCursorPos Function should do the trick for you.

    hope this helps ya
    - Sreehari
    "Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us."
    " Everybody is sent to Earth on a purpose. I am so Lagging behind that i won't die." – Calvin

  3. #3
    Join Date
    May 2005
    Posts
    4,954

    Re: MFC Event Message Problem

    You can use a pooling mechanism like sreehari offered in which you will need to call each interval to ::GetCursorPos() to check where the cursor is.
    Another option is to use mouse hook using ::SetWindowsHookEx() with WH_MOUSE.

    Cheers
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: MFC Event Message Problem

    Mouse hook sample.
    Best regards,
    Igor

  5. #5
    Join Date
    Mar 2005
    Posts
    23

    Re: MFC Event Message Problem

    ::SetWindowsHookEx() is what I was looking for, and it should help me with some other things I am trying to accomplish. Thank you very much for all of your replies.

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