Getting co-ordinates of the screen

This is a discussion on Getting co-ordinates of the screen within the Windows Programming forums, part of the Platform Specific Boards category; I have created a multi-doc application in visual c++ and in the CProjectView class I have used the function: void ...

  1. #1
    swordfish
    Guest

    Talking Getting co-ordinates of the screen

    I have created a multi-doc application in visual c++ and in the CProjectView class I have used the function:

    void CDrawView::OnLButtonDown(UINT nFlags, CPoint point) {

    CString s1;
    CString old;

    CClientDC dc(this);
    //add a crect to the dc at point
    _itoa(point.x, s1, 10);
    old += s1;
    old += " , ";
    _itoa(point.y, s1, 10);
    old += s1;
    AfxMessageBox(old);

    }

    This function is used to add a rectangle to the document and then show the co-ordinates of the point pressed. The problem I'm having is that the co-ordinates showing up are the co-ordinates of what's on the screen, not the whole document. The co-ordinates of the whoe document go up to 1700, 1122. But when I press the bottom-right of the view it shows only 950, 600. If I then scroll across and down and then press the bottom-right of the view again it shows only 950, 600 again(when I want it to show 1700, 1122). Can you help me?

  2. #2
    Unregistered
    Guest
    You might try:

    dc.SetViewportOrg(point.x,point.y);
    /*The previous origin of the viewport (in device coordinates) as a CPoint object.*/

    The return value is the previous origin of the viewport (in device coordinates) as a CPoint object.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. display a char at a particular co ordinates on screen
    By jas_atwal in forum C++ Programming
    Replies: 12
    Last Post: 02-03-2008, 01:21 PM
  2. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  3. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  4. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 03:41 AM
  5. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 01:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21