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

    How to get the cursor position?

    Hi,
    I've created a SDI application. I've derived the CView from CRichEditView class. I've created a menu item, click on that should tell me the cursor position on the client area. I've used GetCursorPos() function. Also i've converted the coordinated to client coordinates by the function ScreenToClient().
    I get a -ve value for the ' y ' coordinate. Can you please tell me how do i get the cursor position, as the +ve coordinates, for each line.

    Thanks,
    Aparna.



  2. #2
    Join Date
    Apr 1999
    Posts
    11

    Re: How to get the cursor position?

    Are you trying to get the current cursor position within the window? If yes, use the OnMouseMove (UINT nFlags, CPoint point) function which gives you the x,y cursor position within the area (point.x and point.y).


  3. #3
    Join Date
    Apr 1999
    Posts
    11

    Re: How to get the cursor position?

    ... Other mouse functions also return the same info, for example OnLButtonDown (UINT nFlags, CPoint point)...


  4. #4
    Join Date
    Apr 1999
    Posts
    18

    Re: How to get the cursor position?

    Hi,
    Thanx for the reply. But can u tell me how do i get the cursor position WM_KEYDOWN message handler.

    Thanks,
    Aparna


  5. #5
    Join Date
    Apr 1999
    Posts
    11

    Re: How to get the cursor position?

    I guess you should first retrieve the window's RECT structure (e.g. RECT MyRect) info (GetWindowRect) then call GetCursorPos and compute the (POINT) MyPoint.x - MyRect.left and MyPoint.y - MyRect.Top coordinates...


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