How to detect Windows XP theme

OMID SOFT

Freshman
Joined
Jan 19, 2006
Messages
36
Location
Richmond Hill
Visual Basic:
    Public Function CurrentTheme() As String
        'Function to get the current Windows XP theme.
        'Optional: You can use it to set different colors for each theme.
        Dim key As RegistryKey
        key = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\ThemeManager")
        If key IsNot Nothing Then
            If "1" = (key.GetValue("ThemeActive").ToString) Then
                Dim s As String
                s = (key.GetValue("ColorName")).ToString()
                If s <> Nothing Then
                    If String.Compare(s, "NormalColor", True) = 0 Then CurrentTheme = "XPBlue" : Exit Function
                    If String.Compare(s, "HomeStead", True) = 0 Then CurrentTheme = "XPGreen" : Exit Function
                    If String.Compare(s, "Metallic", True) = 0 Then CurrentTheme = "XPSilver" : Exit Function
                End If
            End If
        End If
        CurrentTheme = "WindowsClassic"
    End Function
 
Back
Top