Link to home
Start Free TrialLog in
Avatar of gem56
gem56

asked on

How to determine 'Appearance > Color scheme' setting

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?

/Michael
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

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

return 1 means success, returns 0 means failure.
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

screenshot1.jpg
screenshot2.jpg
Avatar of gem56
gem56

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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();
Avatar of gem56

ASKER

Thanks a lot sedgwick.