Thread: GetClientRect() returns value differently every time.

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    3

    GetClientRect() returns value differently every time.

    Hi,

    When I have this code in OnCreate() function, and each time it returns me each different value of ClientRect. Any idea?
    Code:
     
    CRect ClientRect;
    GetClientRect(&ClientRect);
    ClientToScreen(ClientRect);

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    You should check the return values of those functions to make sure they are succeeding, and call GetLastError() if the function fails. Also, you could use the x, y, cx, and cy values of the CREATESTRUCT structure that is passed to the OnCreate() function to get the window size as well.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get current time
    By tsubasa in forum C Programming
    Replies: 3
    Last Post: 05-01-2009, 02:03 AM
  2. Polynomials and ADT's
    By Emeighty in forum C++ Programming
    Replies: 20
    Last Post: 08-19-2008, 08:32 AM
  3. calculating user time and time elapsed
    By Neildadon in forum C++ Programming
    Replies: 0
    Last Post: 02-10-2003, 06:00 PM
  4. relating date....
    By Prakash in forum C Programming
    Replies: 3
    Last Post: 09-19-2001, 09:08 AM