Re: Detecting Windows Styles in VB6



> I need to make a windows call to determine whether a
> computer is using Windows XP or Windows Classic Style, if
> such a call exists. If this is not the proper place for
> this request, please give me the name of a better
> newsgroup.

Try this (ported from: http://addressof.com/blog/archive/2004/02/15/400.aspx )

'***
Private Declare Function GetVersionEx Lib "Kernel32.dll" Alias _
"GetVersionExA" (ByRef lpVersionInfo As OSVersionInfo) As Long
Private Declare Function DllGetVersion Lib "ComCtl32.dll" (ByRef PDVI As DLLVersionInfo) As Long
Private Declare Function IsThemeActive Lib "UXTheme.dll" () As Long
Private Declare Function IsAppThemed Lib "UXTheme.dll" () As Long

Private Type OSVersionInfo
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128 ' Maintenance string for PSS usage
End Type

Private Type DLLVersionInfo
cbSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
End Type

Private Const VER_PLATFORM_WIN32_NT As Long = 2

Public Function IsVisualStylesEnabled() As Boolean
Dim os As OSVersionInfo
Dim Version As DLLVersionInfo

os.dwOSVersionInfoSize = Len(os)
Call GetVersionEx(os)

If ((os.dwPlatformId = VER_PLATFORM_WIN32_NT) And ( _
((os.dwMajorVersion = 5) And (os.dwMinorVersion >= 1)) Or (os.dwMajorVersion > 5))) Then
Version.cbSize = Len(Version)

If (DllGetVersion(Version) = 0) Then _
IsVisualStylesEnabled = (Version.dwMajorVersion > 5) And _
CBool(IsThemeActive()) And CBool(IsAppThemed())
End If
End Function
'***

Hope this helps,

Mike


- Microsoft Visual Basic MVP -
E-Mail: EDais@xxxxxxxx
WWW: Http://EDais.mvps.org/


.



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: How to get an associated file icon without the Alpha Channel i
    ... Private Type PICBMP ... ' Private Declare Function DestroyIcon Lib "user32" ... ByRef pIconInfo As IconInfo) As Long ...
    (microsoft.public.vb.winapi)
  • Re: Picture.Width
    ... Private Declare Function GetBoundsRect Lib "GDI32.dll" (ByVal hDC As Long, ... Private Type RectAPI ... Dim BMInf As Bitmap ...
    (microsoft.public.vb.general.discussion)
  • Re: Controlling location of message box
    ... Private Declare Function GetCurrentThreadId Lib "kernel32" As Long ... (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As ... Private Type MSGBOX_HOOK_PARAMS ...
    (microsoft.public.word.vba.general)