Resolution testing for. . .

This is a discussion on Resolution testing for. . . within the Windows Programming forums, part of the Platform Specific Boards category; I am writting a program and was wondering if there was an easy way to test which resolution the display ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    11

    Unhappy Resolution testing for. . .

    I am writting a program and was wondering if there was an easy way to test which resolution the display was currently in. (i.e. 1024 x 768 or 800 x 600). I was aslo wondering if there was a way change the resolution of the display, from within the program running on the dos window ...

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    GetDeviceCaps( ) is what you're looking for.

    int nWidth = GetDeviceCaps( hDC, HORZRES );
    int nHeight = GetDeviceCaps( hDC, VERTRES );

    As for changing the display, I'm not sure. You can easily do it using DirectX or OpenGL but not sure about straight Win32.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    11

    ty for the option

    I seem to get an error even after i include headers

    error C2065: 'hDC' : undeclared identifier

    Any Idea why?

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    157
    just means that you are using a var 'hDC' that isn't referenced and declared. make sure spelling is correct.

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Somehow I knew that would happen. I should've been more clear. hDC is a variable you create that is a handle to the device context. Look up GetDC ... make sure you ReleaseDC also.

  6. #6
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    GetSystemMetrics

  7. #7
    Registered User
    Join Date
    Feb 2003
    Posts
    11

    Thank you all for the tips and hints.

    I went with MrWizzard's help and it works great .
    Thank you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ubuntu screen resolution
    By lruc in forum Tech Board
    Replies: 13
    Last Post: 11-27-2008, 04:03 PM
  2. OpenGL: Depth Testing, Matrixes, ect.?
    By Zeusbwr in forum Game Programming
    Replies: 8
    Last Post: 12-08-2004, 08:37 AM
  3. C++ bit testing
    By Vicious in forum C++ Programming
    Replies: 3
    Last Post: 09-19-2004, 11:44 AM
  4. program for Radiation Testing
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 02-07-2002, 12:47 AM
  5. Screen Resolution
    By C_Coder in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 12-21-2001, 07:01 PM

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