CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1

    WM_MOUSE move question

    I want to send a synthetic mouse move event to a windows control. I don't want the actually cursor to move but I want the windows control to think the mouse is moving. The following is what I am doing to achieve this result.

    Code:
    ::SetForegroundWindow((HWND)winControl->Handle.ToPointer());
    ::SendMessage((HWND)winControl->Handle.ToPointer(),WM_SETCURSOR,(WPARAM)winControl->Handle.ToPointer(),NULL);
    ::SendMessage((HWND)winControl->Handle.ToPointer(),WM_MOUSEMOVE,0,MAKELONG(2,0));
    When the mouse is moved, the winControl displays the cursors X,Y coords.
    In this example, I want the control to think the cursor is at coords (2,0).
    However the control says that the cursor is at (5.75, -74.5). Does anyone know why this occurs? Am I not sending the message correctly? Thanks!
    -- Brandon Fogerty
    Http://www.brandonfogerty.com

    "Not believing doesn't make something not true"
    May GOD Bless, Strengthen, Guide, Protect, and Reveal Wisdom to you Always!

  2. #2
    Join Date
    Jul 2003
    Posts
    147

    Re: WM_MOUSE move question

    Just a thought, but have you tried sending the position in terms of screen position or in terms of the winControls parent?
    "Live only for tomorrow, and you will have a lot of empty yesterdays today."

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