Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

terminal video resolution APIs

Is there an win32 API to find out the monitor resolution ? To set the monitor resoultion.

Comments

  • pingpongpingpong Member Posts: 937
    [b][red]This message was edited by pingpong at 2002-10-9 12:37:38[/red][/b][hr]
    You can do:
    [code]
    HDC hDC = GetDC(NULL); // screen DC.
    int width = GetDeviceCaps(hDC, HORZRES);
    int height = GetDeviceCaps(hDC, VERTRES);
    int bitsPerPixel = GetDeviceCaps(hDC, BITSPIXEL);

    /////////////////
    // if you really want to be accurate.. Windows could work on 16-colors VGA,
    // this uses planes and not bits/pixel
    int planes = GetDeviceCaps(hDC, PLANES);
    if(planes > 1)
    bitsPerPixel = planes;
    /////////////////

    ReleaseDC(hDC);
    [/code]

    As for changing the current settings, look up ChangeDisplaySettings and EnumDisplaySettings. I have some code that works with those here:
    http://www.geocities.com/al_ani/resolutioner.zip

    : Is there an win32 API to find out the monitor resolution ? To set the monitor resoultion.
    :
    :



  • jtcoelhojtcoelho Member Posts: 44
    Thanks much.
    : [b][red]This message was edited by pingpong at 2002-10-9 12:37:38[/red][/b][hr]
    : You can do:
    : [code]
    : HDC hDC = GetDC(NULL); // screen DC.
    : int width = GetDeviceCaps(hDC, HORZRES);
    : int height = GetDeviceCaps(hDC, VERTRES);
    : int bitsPerPixel = GetDeviceCaps(hDC, BITSPIXEL);
    :
    : /////////////////
    : // if you really want to be accurate.. Windows could work on 16-colors VGA,
    : // this uses planes and not bits/pixel
    : int planes = GetDeviceCaps(hDC, PLANES);
    : if(planes > 1)
    : bitsPerPixel = planes;
    : /////////////////
    :
    : ReleaseDC(hDC);
    : [/code]
    :
    : As for changing the current settings, look up ChangeDisplaySettings and EnumDisplaySettings. I have some code that works with those here:
    : http://www.geocities.com/al_ani/resolutioner.zip
    :
    : : Is there an win32 API to find out the monitor resolution ? To set the monitor resoultion.
    : :
    : :
    :
    :
    :
    :

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _______ { http://forcoder.org } free ebooks and video tutorials about \ Scratch, Visual Basic .NET, C#, Ruby, Visual Basic, C++, C, Assembly, Perl, JavaScript, PL/SQL, Python, Java, MATLAB, Swift, PHP, Delphi, Objective-C, R, Go Kotlin, Julia, LabVIEW, VBScript, Alice, COBOL, Bash, Logo, Rust, Scala, Ada, Erlang, Lua, Hack, D, Dart, Apex, Crystal, ML, Prolog, F#, ABAP, Awk, Clojure, Fortran, Lisp, Scheme, Transact-SQL, SAS, FoxPro \ ___________

Sign In or Register to comment.