Thread: Resolution testing for. . .

  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,138
    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, 05:03 PM
  2. OpenGL: Depth Testing, Matrixes, ect.?
    By Zeusbwr in forum Game Programming
    Replies: 8
    Last Post: 12-08-2004, 09: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, 01:47 AM
  5. Screen Resolution
    By C_Coder in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 12-21-2001, 08:01 PM