|
-
Dec 25th, 2005, 03:28 PM
#1
Thread Starter
Member
Windows Theme!
Hi,
I was wondering how can I determine what windows theme is in use by the user. For example: if blue theme, I want to display "Blue Theme" (or Olive, Silver or Classic).
I know it's not important, but it's something that I want to find out.
Thank you,
Mc
-
Dec 25th, 2005, 03:33 PM
#2
Re: Windows Theme!
You need to use the uxtheme.dll theme APIs to determine if a theme is being used (Windows XP and newer only).
IsThemeActive and GetCurrentThemeName.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 25th, 2005, 03:36 PM
#3
Thread Starter
Member
Re: Windows Theme!
can you assist with a sample please?
thank you
-
Dec 25th, 2005, 03:47 PM
#4
Re: Windows Theme!
Sorry, IsThemeActive is only for a particular app and not globally for your windows session.
I'll whip something up right now.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 25th, 2005, 11:35 PM
#5
Member
Re: Windows Theme!
what's the API declare method
I love VB6
< advertising links removed by moderator >
-
Dec 26th, 2005, 03:23 AM
#6
Re: Windows Theme!
VB Code:
Private Declare Function OpenThemeData Lib "uxtheme" ( _
ByVal hWnd As Long _
ByVal pszClassList As Long _
) As Long
Private Declare Function CloseThemeData Lib "uxtheme" (ByVal hTheme As Long) As Long
Private Declare Function GetCurrentThemeName Lib "uxtheme" ( _
ByVal lpszThemeName As Long, _
ByVal dwMaxNameChars As Long, _
ByVal lpszColorBuff As Long, _
ByVal cchMaxColorChars As Long, _
ByVal lpszSizeBuff As Long, _
ByVal cchMaxSizeChars As Long _
) As Long
Public Function IsXPThemed() As Boolean
Dim hTheme As Long
hTheme = OpenThemeData(0, StrPtr("ExplorerBar"))
If (hTheme) Then
CloseThemeData hTheme
IsXPThemed = True
End If
End Function
Public Function XPThemeName() As String
If (IsXPThemed()) Then
XPThemeName = Space$(260)
GetCurrentThemeName 0, 0, StrPtr(XPThemeName), 260, 0, 0
XPThemeName = Trim$(XPThemeName)
Else
XPThemeName = "n/a"
End If
End Function
Last edited by penagate; Dec 26th, 2005 at 06:19 AM.
-
Dec 26th, 2005, 06:08 AM
#7
Frenzied Member
Re: Windows Theme!
straightaway i can see some problems here. sorry pean, maybe i'm wrong but i think it can cause some problems here
VB Code:
Private Declare Function OpenThemeData Lib "uxtheme" (ByVal hWnd As Long) As Long
hTheme = OpenThemeData(0, StrPtr("ExplorerBar"))
two parameters are passed to OpenThemeData which takes only one parameter.
-
Dec 26th, 2005, 06:11 AM
#8
Re: Windows Theme!
Bahaha, sorry, I forgot the second one 
VB Code:
Private Declare Function OpenThemeData Lib "uxtheme" ( _
ByVal hWnd As Long, _
ByVal pszClassList As Long _
) As Long
-
Dec 26th, 2005, 06:17 AM
#9
Frenzied Member
Re: Windows Theme!
there is still a problem here, it will always be "", null string
VB Code:
Public Function XPThemeName() As String
If (IsXPThemed()) Then
Dim buffer As String: buffer = Space$(260)
GetCurrentThemeName 0, 0, StrPtr(buffer), 260, 0, 0
XPThemeName = Trim$(XPThemeName) '<==XPThemeName is always nothing, make a guess
Else
XPThemeName = "n/a"
End If
End Function
i think it should be
VB Code:
Public Function XPThemeName() As String
If (IsXPThemed()) Then
Dim buffer As String: buffer = Space$(260)
GetCurrentThemeName 0, 0, StrPtr(buffer), 260, 0, 0
XPThemeName = Trim$(buffer)
Else
XPThemeName = "n/a"
End If
End Function
-
Dec 26th, 2005, 06:19 AM
#10
-
Dec 26th, 2005, 06:26 AM
#11
Re: Windows Theme!
I finished this last night but didnt have time to post it. This works and is not for a particular app theming either.
http://www.vbforums.com/showthread.php?t=378272
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|