Windows coordinate

Discussion in 'Win32' started by answerme, Nov 6, 2008.

  1. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    How will i know the window coordinate in MFC .I meant i want to know (x1,y1) & (x2,y2) value
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    When you create a window you specify its size and position.
    Alternatively there's GetWindowRect in the WinAPI.
     
  3. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    I want to know centre point of the window.How can i find it
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    If you've already got x1,y1 and x2,y2, suppose x1=y1=100 and x2=y2=200. What would the centre point be? How would you work that out as an equation using just x1,y1,x2,y2?
     
  5. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    Forget x1,y1,x2,y2

    I have created one window i want to know the centre point my screen .
     
  6. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    It's impossible to forget x1~y2. There are no WinAPI functions that return the centre point of windows (or screens - do not confuse these terms otherwise your question becomes ambiguous. There is a definite difference between a window and a screen). The reason is that you can easily calculate that from the screen size and position, i.e. x1~y2.
     
  7. neo_vi

    neo_vi Member

    Joined:
    Feb 1, 2008
    Messages:
    720
    Likes Received:
    16
    Trophy Points:
    18
    Occupation:
    Software engineer
    Location:
    Earth
    Home Page:
    http://computertipaday.blogspot.com
    u can get a software for measuring the screen size exactly. u can try that. It will give u the size in pixels.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice