Thread: GetSystemMetrics

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    28

    GetSystemMetrics

    when i try to find out what the current size of the screen is I keep getting the maximum size for the screen. here is the code:

    Code:
    x = GetSystemMetrics(SM_CXSCREEN);
               
    TextOut(hdc,cxChar,cyChar,szBuffer,wsprintf(szBuffer,"Screen size is %i",x));
    I guess that I am using this wrong?

    [edit] I am not sure why it is putting a space in szBuffer

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Do you want to get metrics for your window? Then you use either GetWindowRect or GetClientRect as appropriate. GetSystemMetrics will give you the size of the screen for the primary display.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GetSystemMetrics for tab controls?
    By Magos in forum Windows Programming
    Replies: 2
    Last Post: 03-13-2006, 06:07 PM
  2. newbie modal question
    By FOOTOO in forum Windows Programming
    Replies: 2
    Last Post: 03-30-2005, 06:34 PM
  3. GetSystemMetrics LNK2001 error
    By mnj in forum Windows Programming
    Replies: 1
    Last Post: 03-25-2004, 02:55 AM
  4. Something to do with painting???
    By Unimatrix_001 in forum Windows Programming
    Replies: 5
    Last Post: 07-28-2003, 07:45 AM
  5. no errors but still errors
    By Megatron in forum Windows Programming
    Replies: 7
    Last Post: 01-12-2003, 11:21 PM