How to determine 'Appearance > Color scheme' setting

Posted on 2010-01-05
Last Modified: 2012-08-13
Hi guys,

I have a VB6 application in which I need to determine 'Color scheme' setting (as per Control Panel > Appearance > Color scheme) so what API, etc. can I use to do that?

Question by:gem56
    LVL 42

    Expert Comment

    check the code snippet.
    change the scheme name to your favorite.
    Module Module1
        Declare Function DeskSetCurrentScheme Lib "desk.cpl" (ByVal SchemeName As String) As Long
        Sub Main()
            Dim res As Long = DeskSetCurrentScheme("Windows Classic")
        End Sub
    End Module

    Open in new window

    LVL 42

    Expert Comment

    return 1 means success, returns 0 means failure.
    LVL 42

    Expert Comment

    FYI, list of available color schemes  can be found in the registry here:
    HKEY_CURRENT_USER\Control Panel\Appearance\Schemes
    see screenshot1.

    to get the display name which reflect each scheme id, goto:
    HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache
    see screenshot2


    Author Comment

    Thanks a lot for that sedgwick and I will most likely also use that API but for now I need to find out the current setting so is there an equivelant "DeskGetCurrentScheme" API?

    I used Google
    LVL 42

    Accepted Solution

    u need to check the HKEY_CURRENT_USER\Control Panel\Appearance - Current value.
    the value should be one of available schemes listed in screenshot2.
    for example:  @themeui.dll,-855

    LVL 42

    Expert Comment

    so basically is using the following code:
                string currentScheme = Registry.GetValue(@"HKEY_CURRENT_USER\Control Panel\Appearance", "Current", null).ToString();
                string schemeName = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache", currentScheme, null).ToString();

    Author Closing Comment

    Thanks a lot sedgwick.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now