Jump to content

How to determine which version of comctrl32.dll on XP


Recommended Posts

I am working on ListView styles for Koda.

LVS_EX_DOUBLEBUFFER requires ComCtl32.dll version 6.00.

V6.00 was introduced in XP., but XP also has V5.82.

My script should disable LVS_EX_DOUBLEBUFFER if a user is running V5.82. How can my script determine which version of Comctl32 Autoit is running on XP?

This may also be a valid question for Vista and Win7.

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
Share on other sites

:)

MsgBox(0,"",FileGetVersion("ComCtl32.dll"))

Edit:

Btw, on my Win7 this reports "6.10.7601.17514", so something like

if StringLeft(FileGetVersion("ComCtl32.dll"),1) > 5 Then
Else
endif

should do... but I'm not sure if this is really necessary or if LVS_EX_DOUBLEBUFFER might just be ignored in a call to v5.82.

Edited by KaFu
Link to comment
Share on other sites

Thank you. You code works. I get 6.0.2980.6028.

For what I am doing, it is not sufficient that LVS_EX_DOUBLEBUFFER be ignored on some PCs. The script I am working on will give any user a way of choosing the styles of his ListView control. The dialog has a checkbox "Double buffer to reduce flicker". This checkbox should be disabled if comctl32.dll is earlier than 6.0 -- so a user with Win 2000 will find that this checkbox is disabled.

Two pages on MSDN led to my question: Enabling Visual Styles and Common Control Versions. From these pages I understand that:

  • A manifest or a compiler directive is required to specify 6.0
  • XP (for example) has both 5.82 and 6.0.
I guess that, because there is no manifest for AutoIt, 6.0 may be specified in AutoIt.exe. But I don't know. I wish I did!
Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
Share on other sites

Thank you. You code works. I get 6.0.2980.6028.

For what I am doing, it is not sufficient that LVS_EX_DOUBLEBUFFER be ignored on some PCs. The script I am working on will give any user a way of choosing the styles of his ListView control. The dialog has a checkbox "Double buffer to reduce flicker". This checkbox should be disabled if comctl32.dll is earlier than 6.0 -- so a user with Win 2000 will find that this checkbox is disabled.

Two pages on MSDN led to my question: Enabling Visual Styles and Common Control Versions. From these pages I understand that:

  • A manifest or a compiler directive is required to specify 6.0
  • XP (for example) has both 5.82 and 6.0.
I guess that, because there is no manifest for AutoIt, 6.0 may be specified in AutoIt.exe. But I don't know. I wish I did!

version 6 is specified in the manifest

this is from a 'compiled' v3.3.6.1 exe (in the stub)

<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" language="*"

I see fascists...

Link to comment
Share on other sites

Another way:

Global Const $tagDLLVERSIONINFO = "dword cbSize;dword dwMajorVersion;dword dwMinorVersion;dword dwBuildNumber;dword dwPlatformID"

MsgBox(0,"ComCtl32.dll Info",DLLGetVersion_ComCtl32())

Func DLLGetVersion_ComCtl32($FLAG=4)
    Local $ALL_INFO
    Local $STRUCT = DllStructCreate($tagDLLVERSIONINFO)
    DllStructSetData($STRUCT,"cbSize",20)
    Local $RESULT = DllCall("comctl32.dll","int","DllGetVersion","ptr",DllStructGetPtr($STRUCT))
    If $RESULT[0] = 0 Then
        Switch $FLAG
            Case 0  ;Major Version
                Return DllStructGetData($STRUCT,"dwMajorVersion")
            Case 1  ;Minor Version
                Return DllStructGetData($STRUCT,"dwMinorVersion")
            Case 2  ;Build Number
                Return DllStructGetData($STRUCT,"dwBuildNumber")
            Case 3  ;Platform ID
                Return DllStructGetData($STRUCT,"dwPlatformID")
            Case 4  ;All Info
                $ALL_INFO = "Major Version: " & DllStructGetData($STRUCT,"dwMajorVersion") & @CRLF & _
                            "Minor Version: " & DllStructGetData($STRUCT,"dwMinorVersion") & @CRLF & _
                            "Build Number: " & DllStructGetData($STRUCT,"dwBuildNumber") & @CRLF & _
                            "Platfor ID: " & DllStructGetData($STRUCT,"dwPlatformID")
                Return $ALL_INFO
        EndSwitch
    EndIf
EndFunc

When the words fail... music speaks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...