Click here to Skip to main content
15,868,016 members
Articles / Desktop Programming / MFC
Article

ResSwitch & ResList v1.2 - Easily change screen resolution

Rate me:
Please Sign up or sign in to vote.
4.88/5 (22 votes)
3 Mar 2000 196.7K   2.7K   29   26
2 freeware utilities to quickly change Screen Depth and Resolution.
  • Download source files - 19 Kb
  • Introduction

    Tired of using the Windows Control panel or QuickRes to change your graphics cards screen depth & resolution? This program uses the command line sent to it to change the screen depth & resolution. For example to change into 1024 * 768 in 24 bit color, just use the command line ResSwitch.exe 1024 768 24 0. With this structure you can create a number of shortcuts to ResSwitch on your desktop using different command lines which will allow you to change mode with a simple double click on your desktop. By setting up shortcut keys in the shortcut file to ResSwitch you can quickly change modes by just using the keyboard only. The size of the binary file itself is only 6K.

    Also included is ResList which is a simple console app which lists the available video modes which ResSwitch can use.

    The source zip file contains the ResSwitch and ResList source code, a very handy MFC class to wrap access to the two underlying APIs. ResSwitch and ResList use and a prebuilt binary version of both programs. The enclosed binary requires that you have the MFC 4.2b DLLs already installed. If you haven't already got them on your machine (MFC42.DLL in your Windows system directory), then grab them from Microsoft's web site at http://activex.microsoft.com/controls/vc/mfc42.cab.


    Usage
    History
    API Reference
    Contacting the Author


    Usage

    • To use the class in your code simply include videomod.cpp in your project and #include videomod.h in which ever of your modules needs to make calls to the class.
    • Your code will need to include MFC either statically or dynamically.
    • You will also need to have afxtempl.h in your precompiled header.
    • To see the class in action, have a look at the code in the main function in the module ResList.cpp or the Winmain function in the module ResSwitch.cpp.


    History

    v1.1 (25 September 1997)
    • Changed name QuickerRes to QRes to avoid conflict with a similarly named third party product.
    • Now supports setting the monitor frequency (NT only according to the documentation).
    • Inclusion of a new console mode program called QList (binary & source code) with enumerates all the video modes available. Comes in helpful if QRes is reporting that some options you select are unavailable.

    v1.2 (4 January 1999)

    • Changed name (yet again) from QRes to ResSwitch to avoid conflict with another similarly named third party product.
    • Source code now ships with Visual C++ 5 workspace files now as standard.
    • All source code is now fully UNICODE enabled and UNICODE build configurations are now provided.
    • General tidy up of the codebase.


    API Reference

    The API consists of the public member functions of the classes CVideoMode & CVideoModes.

    CVideoMode
    CVideoModes::GetCurrentVideoMode
    CVideoModes::GetAvailableVideoModes
    CVideoModes::ChangeVideoModePermanently
    CVideoModes::ChangeVideoModeTemporarily
    CVideoModes::CanChangeVideoMode
    CVideoModes::RevertVideoModeToDefault


    CVideoMode

    Remarks:
    This class is an encapsulation of a video mode. It contains 4 public member variables, namely:
    • m_dwBitsPerPixel -- Specifies in bits per pixel the colour resolution of the display device. For example: 4 bits for 16 colours, 8 bits for 256 colours, or 16 bits for 65,536 colours.
    • m_dwWidth -- Specifies the width, in pixels, of the display device.
    • m_dwHeight -- Specifies the height, in pixels, of the display device.
    • m_dwFrequency -- Specifies the frequency, in hertz of the display device in a particular mode. On some early builds of Windows 95, changing the frequency of the display adapter is not supported and this value should be set to 0 which means the default hardware value.


    CVideoModes::GetCurrentVideoMode

    static BOOL CVideoModes::GetCurrentVideoMode(CVideoMode& mode);

    Return Value:
    TRUE if the current video mode was retrieved successfully otherwise FALSE.

    Parameters:

    • mode -- Upon successful return this will contain the current video mode of the main display adapter.

    Remarks:
    Internally this retrieves the current settings GetDeviceCaps() function on a device context for the display.


    CVideoModes::GetAvailableVideoModes

    static BOOL CVideoModes::GetAvailableVideoModes(CAvailableVideoModes& modes);

    Return Value:
    TRUE if the available video modes were retrieved successfully otherwise FALSE.

    Parameters:

    • modes -- Upon successful return this will contain an array containing the available video modes of the main display adapter.

    Remarks:
    Returns all the video modes which the display adapter supports.

    CAvailableVideoModes is defined as follows:
    typedef CArray<CVideoMode, CVideoMode&> CAvailableVideoModes;


    CVideoModes::ChangeVideoModePermanently

    static LONG CVideoModes::ChangeVideoModePermanently(const CVideoMode& mode);

    Return Value:
    Returns one of the following values:

    Value Meaning
    DISP_CHANGE_SUCCESSFUL The settings change was successful.
    DISP_CHANGE_RESTART The computer must be restarted in order for the graphics mode to work.
    DISP_CHANGE_BADFLAGS An invalid set of flags was passed in.
    DISP_CHANGE_FAILED The display driver failed the specified graphics mode.
    DISP_CHANGE_BADMODEThe graphics mode is not supported.
    DISP_CHANGE_NOTUPDATED Unable to write settings to the registry.

    Parameters:

    • mode -- The video mode to change into.

    Remarks:
    If this function succeeds then the changes are permanent, meaning that upon next boot of Windows the video mode will be the preserved to that which you just changed into.


    CVideoModes::ChangeVideoModeTemporarily

    static LONG CVideoModes::ChangeVideoModeTemporarily(const CVideoMode& mode);

    Return Value:
    The return value is the same as ChangeVideoModePermanently.

    Parameters:

    • mode -- The video mode to change into.

    Remarks:
    If this function succeeds then the changes are not permanent, meaning that upon next boot of Windows the video mode will be the the same as before you called this function.


    CVideoModes::CanChangeVideoMode

    static LONG CVideoModes::CanChangeVideoMode(const CVideoMode& mode);

    Return Value:
    The return value is the same as ChangeVideoModePermanently.

    Parameters:

    • mode -- he video mode to test whether or not the change can be made.

    Remarks:
    Using this function allows an application to determine if a specified graphics modes is actually valid, without causing the system to change to that graphics mode.


    CVideoModes::RevertVideoModeToDefault

    static LONG CVideoModes::RevertVideoModeToDefault();

    Return Value:
    The return value is the same as ChangeVideoModePermanently.

    Remarks:
    Using this function allows an application to determine if a specified graphics modes is actually valid, without causing the system to change to that graphics mode.



    Contacting the Author

    PJ Naughter
    Email: pjn@indigo.ie
    Web: http://www.naughter.com
    4th January 1999


    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    Written By
    United States United States
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    GeneralMy vote of 5 Pin
    Jeroen Walter28-Dec-11 22:34
    Jeroen Walter28-Dec-11 22:34 
    GeneralNot supported Pin
    Jason Lieber3-Jun-08 13:31
    Jason Lieber3-Jun-08 13:31 
    GeneralThanks Buddy Pin
    PraxUnited15-Apr-08 20:34
    PraxUnited15-Apr-08 20:34 
    GeneralSome hints Pin
    Dmitry_Bond10-Apr-08 22:09
    Dmitry_Bond10-Apr-08 22:09 
    GeneralVisual Basic Pin
    james.howell9-Aug-07 8:49
    james.howell9-Aug-07 8:49 
    Generalchange color depth without reboot on win95 Pin
    Rudy Scott8-Aug-03 15:25
    sussRudy Scott8-Aug-03 15:25 
    GeneralRe: change color depth without reboot on win95 Pin
    sabrown1002-Jan-08 5:58
    sabrown1002-Jan-08 5:58 
    GeneralProblem in Compiling error MFC42.lib not found Pin
    Azhar Javaid5-Aug-03 20:55
    Azhar Javaid5-Aug-03 20:55 
    GeneralRe: Problem in Compiling error MFC42.lib not found Pin
    pjnaughter5-Aug-03 23:15
    pjnaughter5-Aug-03 23:15 
    GeneralWoW - great work! Pin
    Yovav7-Apr-03 5:16
    Yovav7-Apr-03 5:16 
    GeneralRe: WoW - great work! Pin
    pjnaughter7-Apr-03 6:25
    pjnaughter7-Apr-03 6:25 
    GeneralRe: WoW - great work! Pin
    Yovav7-Apr-03 7:14
    Yovav7-Apr-03 7:14 
    GeneralRe: WoW - great work! Pin
    pjnaughter7-Apr-03 8:33
    pjnaughter7-Apr-03 8:33 
    Generalcontrolling rescopy output ? Pin
    flashkid1-May-03 11:45
    flashkid1-May-03 11:45 
    GeneralRe: controlling rescopy output ? Pin
    pjnaughter1-May-03 12:18
    pjnaughter1-May-03 12:18 
    GeneralRe: WoW - great work! Pin
    dont_feed_the_goat19-Nov-03 10:57
    dont_feed_the_goat19-Nov-03 10:57 
    GeneralProblem: Taskbar doesn't move Pin
    Maciek Niedzielski3-Dec-02 11:48
    Maciek Niedzielski3-Dec-02 11:48 
    GeneralRe: Problem: Taskbar doesn't move Pin
    pjnaughter3-Dec-02 12:41
    pjnaughter3-Dec-02 12:41 
    GeneralGood job, but... Pin
    FranFLY25-Nov-02 23:45
    FranFLY25-Nov-02 23:45 
    GeneralRe: Good job, but... Pin
    pjnaughter26-Nov-02 22:53
    pjnaughter26-Nov-02 22:53 
    GeneralRe: Good job, but... Pin
    Yovav7-Apr-03 5:14
    Yovav7-Apr-03 5:14 
    GeneralRe: Good job, but... Pin
    pjnaughter7-Apr-03 6:27
    pjnaughter7-Apr-03 6:27 
    QuestionCan you help me? Pin
    Radu Vaileanu21-Aug-02 13:47
    Radu Vaileanu21-Aug-02 13:47 
    AnswerRe: Can you help me? Pin
    pjnaughter21-Aug-02 23:29
    pjnaughter21-Aug-02 23:29 
    GeneralKudos! Pin
    Glenn Carr8-Feb-02 4:53
    Glenn Carr8-Feb-02 4:53 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.