Re: Determining Win XP vs. Classic styles



Back to the original question, this is how I handle it:
check OS version and IFit's XP or above then call uxtheme functions.
This way you don't have to deal with error handling.

Stick this in a module and call then IsXPThemActive property.

HTH,
Andy.

' TYPE
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type

' ENUM
Private Enum Enum_OperatingSystem
System_Windows_32 = 0
System_Windows_95 = 1
System_Windows_98 = 2
System_Windows_ME = 3
System_Windows_NT = 4
System_Windows_2K = 5
System_Windows_XP = 6
System_Windows_2003 = 7
End Enum
Private Enum Enum_OperatingPlatform
Platform_Windows_32 = 0
Platform_Windows_95_98_ME = 1
Platform_Windows_NT_2K_XP = 2
End Enum

' API
Private Declare Function GetVersionExA Lib "kernel32" (lpVersionInformation
As OSVERSIONINFO) As Long
Private Declare Function IsThemeActive Lib "uxtheme.dll" () As Long
Private Declare Function IsAppThemed Lib "uxtheme.dll" () As Long

Private Function OperatingSystem() As Enum_OperatingSystem
Dim lpVersionInformation As OSVERSIONINFO
' Retrieve operating system
lpVersionInformation.dwOSVersionInfoSize = Len(lpVersionInformation)
Call GetVersionExA(lpVersionInformation)
If (lpVersionInformation.dwPlatformId = Platform_Windows_32) Then
OperatingSystem = System_Windows_32
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_95_98_ME)
And (lpVersionInformation.dwMinorVersion = 0) Then
OperatingSystem = System_Windows_95
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_95_98_ME)
And (lpVersionInformation.dwMinorVersion = 10) Then
OperatingSystem = System_Windows_98
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_95_98_ME)
And (lpVersionInformation.dwMinorVersion = 90) Then
OperatingSystem = System_Windows_ME
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_NT_2K_XP)
And (lpVersionInformation.dwMajorVersion < 5) Then
OperatingSystem = System_Windows_NT
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_NT_2K_XP)
And (lpVersionInformation.dwMajorVersion = 5) And
(lpVersionInformation.dwMinorVersion = 0) Then
OperatingSystem = System_Windows_2K
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_NT_2K_XP)
And (lpVersionInformation.dwMajorVersion = 5) And
(lpVersionInformation.dwMinorVersion = 1) Then
OperatingSystem = System_Windows_XP
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_NT_2K_XP)
And (lpVersionInformation.dwMajorVersion = 5) And
(lpVersionInformation.dwMinorVersion = 2) Then
OperatingSystem = System_Windows_2003
End If
End Function

Public Property Get IsXPThemActive() As Boolean
' Return true if Windows is XP or above AND if visual style
' are in use by OS AND application
If OperatingSystem >= System_Windows_XP Then
IsXPThemActive = CBool(IsThemeActive) And CBool(IsAppThemed)
End If
End Property



"Jack Owens" <jack_s_owens@xxxxxxxxxxx> ha scritto nel messaggio
news:00f501c54aa1$c37015e0$a501280a@xxxxxxxxxx
> How do I make a call to Windows in VB6 to determine
> whether the computer running a VB app. is using Windows XP
> style or Windows Classic style?


.



Relevant Pages

  • Re: Detect Application Launch
    ... > do it more elegantly via a hook if such a method were available. ... 'Register this form with Windows to receive the ShellHook message ... Private Declare Function RegisterShellHookWindow Lib "user32" (ByVal hwnd As ...
    (microsoft.public.vb.winapi)
  • Re: Detect Application Launch
    ... > 'Removes the extension from the passed filename. ... > Private Declare Function RegisterShellHookWindow Lib "user32" (ByVal hwnd ... you'll probably want to ignore child and maybe even popup windows ...
    (microsoft.public.vb.winapi)
  • Re: Detecting Windows Styles in VB6
    ... > computer is using Windows XP or Windows Classic Style, ... Private Declare Function DllGetVersion Lib "ComCtl32.dll" As Long ... Private Type DLLVersionInfo ...
    (microsoft.public.vb.general.discussion)
  • Re: Double-Paste Problem in VB6 RichTextBox on WinXP
    ... Private Declare Function GetDeviceCaps Lib "gdi32" _ ... Public Declare Function StartDoc Lib "gdi32" Alias _ ...
    (comp.lang.basic.visual.misc)
  • Re: Double-Paste Problem in VB6 RichTextBox on WinXP
    ... Private Declare Function GetDeviceCaps Lib "gdi32" _ ... Public Declare Function StartDoc Lib "gdi32" Alias _ ...
    (comp.lang.basic.visual.misc)

Loading