Search Tools Links Login

WebOne Windows XP Classic Theme On Detection *Minor Fixes*


Visual Basic 6, or VB Classic

*MINOR FIX* NOW YOU CAN DETECT Whether Windows XP is running in classic style or without visual styles. The function called can also be used to tell theme color if themes are on. If themes are not on then the function will fail and this code will trap the error and return False. REQUIRES "themeui.dll" Should be on Windows XP versions because this is the theme system. THIS FILE IS NOT THE ONE USED FOR DRAWING THEMES. Please let me know of any problems. I reply to all emails. Also check out my other cool submissions. THIS IS DONE IN ONLY 14 LINES OF REAL CODE NOT COMMENTS

Original Author: Thomas Yates

Inputs

No Inputs

Assumptions

Look under X:/Windows/System32/ for the Themeui.dll file where X = Windows System Drive

Returns

Boolean

Side Effects

May not work in systems that are not XP. Please let me know!

API Declarations

None. Uses the dll for calls

Code

Dim TheCurrentTheme As New Theme.Theme
Dim Manager As New ThemeManager
Public Function ClassicThemeOn() as Boolean
Dim Testit ' Used to catch if windows is in classic mode
Set TheCurrentTheme = Manager.SelectedTheme

'Test to see if windows is in classic style
On Error Resume Next
Testit = TheCurrentTheme.VisualStyleColor
If Err.Number = -2147024894 Then
  'Error number is the number caused
  'when themed.VisualStyleColor Fails
  'when in clasic mode
  ClassicThemeOn = True
Else
  ClassicThemeOn = False
End If
On Error GoTo 0
End Function

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 103 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.