I found out how to get the versioning information however I cant find the value for <br>VFT2_FONT_RASTER, VFT2_FONT_VECTOR, and VFT2_FONT_TREUTYPE, I seem some values from the 16bit example, but it wouldnt be right because they would be the same value as DRV_PRINTER, DRV_KEYBOARD, and DRV_LANGUAGE in the same select case.<br><br>well here's the thing from the MSDN that shows how to use the version.dll (32bit)<br><br><FONT FACE=monospace><br>How to Use Functions in VERSION.DLL -- A 32-bit Sample App <br><br>--------------------------------------------------------------------------------<br>The information in this article applies to:<br><br>Microsoft Visual Basic Standard, Professional, and Enterprise Editions, 32-bit only, for Windows, version 4.0<br><br>--------------------------------------------------------------------------------<br><br><br>SUMMARY<br>This article contains code and instructions that demonstrate how to create a sample application that uses some of the functions in VERSION.DLL to retrieve file information embedded into a file with the resource compiler (RC.EXE). <br><br>NOTE: This code only works in Visual Basic version 4.0, 32-bit for Windows. To obtain a Visual Basic version 4.0 16-bit for Windows, example of this code, please see the following article in the Microsoft Knowledge Base: <br><br><br>Q112731 : How to Use Functions in VER.DLL -- a 16-bit Sample Application <br><br>This Visual Basic application was modeled after the Verstamp sample program included in the Microsoft Windows Software Development Kit (SDK). <br><br>Additional information can be found in the following documents: <br><br>Microsoft Win32 SDK<br><br><br>Win32 API Declarations for Visual Basic (WIN32API.TXT) located in the WINAPI subdirectory of Visual Basic 4.0 <br><br><br><br><br><br>MORE INFORMATION<br>Instead of offering this article in a number of steps, we have modified our usual format to make it easier for you to create and use this Visual Basic application. Therefore, the three files you need (VERINFO.BAS, VERINFO1.FRM, VERINFO2.FRM) are listed below so you can easily copy them into a text editor and save them as separate files. Instructions on how to use the files are embedded in the files as comments. <br><br><br>VERINFO.BAS<br>' Place the following code in a single text file called VERINFO.BAS:<br>'<br>' The Global constants below are defined in the VER.H header file, also<br>' included in Microsoft C/C++ 7.0, and the Windows SDK.<br>'<br>' **** Global variables used in both forms ****<br>Public Filename As String<br>Public Directory As String<br>Public FullFileName As String<br><br>Public StrucVer As String<br>Public FileVer As String<br>Public ProdVer As String<br>Public FileFlags As String<br>Public FileOS As String<br>Public FileType As String<br>Public FileSubType As String<br><br>Type VS_FIXEDFILEINFO<br> dwSignature As Long<br> dwStrucVersionl As Integer ' e.g. = &h0000 = 0<br> dwStrucVersionh As Integer ' e.g. = &h0042 = .42<br> dwFileVersionMSl As Integer ' e.g. = &h0003 = 3<br> dwFileVersionMSh As Integer ' e.g. = &h0075 = .75<br> dwFileVersionLSl As Integer ' e.g. = &h0000 = 0<br> dwFileVersionLSh As Integer ' e.g. = &h0031 = .31<br> dwProductVersionMSl As Integer ' e.g. = &h0003 = 3<br> dwProductVersionMSh As Integer ' e.g. = &h0010 = .1<br> dwProductVersionLSl As Integer ' e.g. = &h0000 = 0<br> dwProductVersionLSh As Integer ' e.g. = &h0031 = .31<br> dwFileFlagsMask As Long ' = &h3F for version "0.42"<br> dwFileFlags As Long ' e.g. VFF_DEBUG Or VFF_PRERELEASE<br> dwFileOS As Long ' e.g. VOS_DOS_WINDOWS16<br> dwFileType As Long ' e.g. VFT_DRIVER<br> dwFileSubtype As Long ' e.g. VFT2_DRV_KEYBOARD<br> dwFileDateMS As Long ' e.g. 0<br> dwFileDateLS As Long ' e.g. 0<br>End Type<br><br>Declare Function GetFileVersionInfo Lib "Version.dll" Alias _<br> "GetFileVersionInfoA" (ByVal lptstrFilename As String, ByVal _<br> dwhandle As Long, ByVal dwlen As Long, lpData As Any) As Long<br>Declare Function GetFileVersionInfoSize Lib "Version.dll" Alias _<br> "GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, _<br> lpdwHandle As Long) As Long<br>Declare Function VerQueryValue Lib "Version.dll" Alias _<br> "VerQueryValueA" (pBlock As Any, ByVal lpSubBlock As String, _<br> lplpBuffer As Any, puLen As Long) As Long<br>Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" _<br> (dest As Any, ByVal Source As Long, ByVal length As Long)<br>Declare Function GetSystemDirectory Lib "kernel32" Alias _<br> "GetSystemDirectoryA" (ByVal Path As String, ByVal cbBytes As Long) As<br>Long<br><br>' ===== From Win32 Ver.h =================<br>' ----- VS_VERSION.dwFileFlags -----<br>Public Const VS_FFI_SIGNATURE = &HFEEF04BD<br>Public Const VS_FFI_STRUCVERSION = &H10000<br>Public Const VS_FFI_FILEFLAGSMASK = &H3F&<br><br>' ----- VS_VERSION.dwFileFlags -----<br>Public Const VS_FF_DEBUG = &H1<br>Public Const VS_FF_PRERELEASE = &H2<br>Public Const VS_FF_PATCHED = &H4<br>Public Const VS_FF_PRIVATEBUILD = &H8<br>Public Const VS_FF_INFOINFERRED = &H10<br>Public Const VS_FF_SPECIALBUILD = &H20<br><br>' ----- VS_VERSION.dwFileOS -----<br>Public Const VOS_UNKNOWN = &H0<br>Public Const VOS_DOS = &H10000<br>Public Const VOS_OS216 = &H20000<br>Public Const VOS_OS232 = &H30000<br>Public Const VOS_NT = &H40000<br><br>Public Const VOS__BASE = &H0<br>Public Const VOS__WINDOWS16 = &H1<br>Public Const VOS__PM16 = &H2<br>Public Const VOS__PM32 = &H3<br>Public Const VOS__WINDOWS32 = &H4<br><br>Public Const VOS_DOS_WINDOWS16 = &H10001<br>Public Const VOS_DOS_WINDOWS32 = &H10004<br>Public Const VOS_OS216_PM16 = &H20002<br>Public Const VOS_OS232_PM32 = &H30003<br>Public Const VOS_NT_WINDOWS32 = &H40004<br><br>' ----- VS_VERSION.dwFileType -----<br>Public Const VFT_UNKNOWN = &H0<br>Public Const VFT_APP = &H1<br>Public Const VFT_DLL = &H2<br>Public Const VFT_DRV = &H3<br>Public Const VFT_FONT = &H4<br>Public Const VFT_VXD = &H5<br>Public Const VFT_STATIC_LIB = &H7<br><br>' ----- VS_VERSION.dwFileSubtype for VFT_WINDOWS_DRV -----<br>Public Const VFT2_UNKNOWN = &H0<br>Public Const VFT2_DRV_PRINTER = &H1<br>Public Const VFT2_DRV_KEYBOARD = &H2<br>Public Const VFT2_DRV_LANGUAGE = &H3<br>Public Const VFT2_DRV_DISPLAY = &H4<br>Public Const VFT2_DRV_MOUSE = &H5<br>Public Const VFT2_DRV_NETWORK = &H6<br>Public Const VFT2_DRV_SYSTEM = &H7<br>Public Const VFT2_DRV_INSTALLABLE = &H8<br>Public Const VFT2_DRV_SOUND = &H9<br>Public Const VFT2_DRV_COMM = &HA <br><br><br>VERINFO1.FRM<br>' The following is a text dump of the form VERINFO1. It includes the form<br>' and control description as well as necessary Function and Sub procedures.<br>' Save the code in a single TEXT file called VERINFO1.FRM and you can then<br>' load it as a form in Visual Basic.<br>'<br>VERSION 4.00<br>Begin VB.Form Form1<br> Appearance = 0 'Flat<br> BackColor = &H80000005&<br> BorderStyle = 1 'Fixed Single<br> Caption = "VerInfo Demo"<br> ClientHeight = 4290<br> ClientLeft = 2340<br> ClientTop = 2160<br> ClientWidth = 3855<br> BeginProperty Font<br> name = "MS Sans Serif"<br> charset = 0<br> weight = 700<br> size = 8.25<br> underline = 0 'False<br> italic = 0 'False<br> strikethrough = 0 'False<br> EndProperty<br> ForeColor = &H80000008&<br> Height = 4755<br> Left = 2250<br> LinkMode = 1 'Source<br> LinkTopic = "Form1"<br> ScaleHeight = 17.875<br> ScaleMode = 4 'Character<br> ScaleWidth = 32.125<br> Top = 1785<br> Width = 4035<br> Begin VB.DriveListBox Drive1<br> Appearance = 0 'Flat<br> Height = 315<br> Left = 1830<br> TabIndex = 7<br> Top = 3795<br> Width = 1905<br> End<br> Begin VB.DirListBox Dir1<br> Appearance = 0 'Flat<br> Height = 2055<br> Left = 1830<br> TabIndex = 5<br> Top = 1305<br> Width = 1890<br> End<br> Begin VB.FileListBox File1<br> Appearance = 0 'Flat<br> Height = 3150<br> Left = 120<br> TabIndex = 3<br> Top = 984<br> Width = 1575<br> End<br> Begin VB.TextBox Text1<br> Appearance = 0 'Flat<br> Height = 288<br> Left = 1092<br> TabIndex = 1<br> Text = "*.*"<br> Top = 204<br> Width = 2544<br> End<br> Begin VB.Label Label1<br> Appearance = 0 'Flat<br> BackColor = &H80000005&<br> Caption = "Dri&ves:"<br> ForeColor = &H80000008&<br> Height = 210<br> Index = 4<br> Left = 1830<br> TabIndex = 6<br> Top = 3480<br> Width = 660<br> End<br> Begin VB.Label Label1<br> Appearance = 0 'Flat<br> BackColor = &H80000005&<br> Caption = "&Directories:"<br> ForeColor = &H80000008&<br> Height = 195<br> Index = 3<br> Left = 1830<br> TabIndex = 4<br> Top = 990<br> Width = 1230<br> End<br> Begin VB.Label Label1<br> Appearance = 0 'Flat<br> BackColor = &H80000005&<br> Caption = "c:\"<br> ForeColor = &H80000008&<br> Height = 204<br> Index = 2<br> Left = 1830<br> TabIndex = 8<br> Top = 648<br> Width = 1884<br> End<br> Begin VB.Label Label1<br> Appearance = 0 'Flat<br> BackColor = &H80000005&<br> Caption = "&Files:"<br> ForeColor = &H80000008&<br> Height = 204<br> Index = 0<br> Left = 120<br> TabIndex = 2<br> Top = 648<br> Width = 612<br> End<br> Begin VB.Label Label1<br> Appearance = 0 'Flat<br> BackColor = &H80000005&<br> Caption = "File&Name:"<br> ForeColor = &H80000008&<br> Height = 204<br> Index = 1<br> Left = 120<br> TabIndex = 0<br> Top = 252<br> Width = 936<br> End<br>End<br>Attribute VB_Name = "Form1"<br>Attribute VB_Creatable = False<br>Attribute VB_Exposed = False<br>Private Sub Dir1_Change()<br> File1.Path = Dir1.Path<br> Label1(2).Caption = File1.Path<br>End Sub<br><br>Private Sub DisplayVerInfo()<br> '*** Get Version Info ****<br><br> Filename = File1.List(File1.ListIndex)<br> Directory = Label1(2).Caption<br> FullFileName = Label1(2).Caption + "\" + Filename$<br><br> Dim rc As Long<br> Dim lDummy As Long<br> Dim sBuffer() As Byte<br> Dim lBufferLen As Long<br> Dim lVerPointer As Long<br> Dim udtVerBuffer As VS_FIXEDFILEINFO<br> Dim lVerbufferLen As Long<br><br><br> '*** Get size ****<br> lBufferLen = GetFileVersionInfoSize(FullFileName, lDummy)<br> If lBufferLen < 1 Then<br> MsgBox "No Version Info available!"<br> Exit Sub<br> End If<br><br> '**** Store info to udtVerBuffer struct ****<br> ReDim sBuffer(lBufferLen)<br> rc = GetFileVersionInfo(FullFileName, 0&, lBufferLen, sBuffer(0))<br> rc = VerQueryValue(sBuffer(0), "\", lVerPointer, lVerbufferLen)<br> MoveMemory udtVerBuffer, lVerPointer, Len(udtVerBuffer)<br><br> '**** Determine Structure Version number - NOT USED ****<br> StrucVer = Format$(udtVerBuffer.dwStrucVersionh) & "." & _<br> Format$(udtVerBuffer.dwStrucVersionl)<br><br> '**** Determine File Version number ****<br> FileVer = Format$(udtVerBuffer.dwFileVersionMSh) & "." & _<br> Format$(udtVerBuffer.dwFileVersionMSl) & "." & _<br> Format$(udtVerBuffer.dwFileVersionLSh) & "." & _<br> Format$(udtVerBuffer.dwFileVersionLSl)<br><br> '**** Determine Product Version number ****<br> ProdVer = Format$(udtVerBuffer.dwProductVersionMSh) & "." & _<br> Format$(udtVerBuffer.dwProductVersionMSl) & "." & _<br> Format$(udtVerBuffer.dwProductVersionLSh) & "." & _<br> Format$(udtVerBuffer.dwProductVersionLSl)<br><br> '**** Determine Boolean attributes of File ****<br> FileFlags = ""<br> If udtVerBuffer.dwFileFlags And VS_FF_DEBUG _<br> Then FileFlags = "Debug "<br> If udtVerBuffer.dwFileFlags And VS_FF_PRERELEASE _<br> Then FileFlags = FileFlags & "PreRel "<br> If udtVerBuffer.dwFileFlags And VS_FF_PATCHED _<br> Then FileFlags = FileFlags & "Patched "<br> If udtVerBuffer.dwFileFlags And VS_FF_PRIVATEBUILD _<br> Then FileFlags = FileFlags & "Private "<br> If udtVerBuffer.dwFileFlags And VS_FF_INFOINFERRED _<br> Then FileFlags = FileFlags & "Info "<br> If udtVerBuffer.dwFileFlags And VS_FF_SPECIALBUILD _<br> Then FileFlags = FileFlags & "Special "<br> If udtVerBuffer.dwFileFlags And VFT2_UNKNOWN _<br> Then FileFlags = FileFlags + "Unknown "<br><br> '**** Determine OS for which file was designed ****<br> Select Case udtVerBuffer.dwFileOS<br> Case VOS_DOS_WINDOWS16<br> FileOS = "DOS-Win16"<br> Case VOS_DOS_WINDOWS32<br> FileOS = "DOS-Win32"<br> Case VOS_OS216_PM16<br> FileOS = "OS/2-16 PM-16"<br> Case VOS_OS232_PM32<br> FileOS = "OS/2-16 PM-32"<br> Case VOS_NT_WINDOWS32<br> FileOS = "NT-Win32"<br> Case other<br> FileOS = "Unknown"<br> End Select<br> Select Case udtVerBuffer.dwFileType<br> Case VFT_APP<br> FileType = "App"<br> Case VFT_DLL<br> FileType = "DLL"<br> Case VFT_DRV<br> FileType = "Driver"<br> Select Case udtVerBuffer.dwFileSubtype<br> Case VFT2_DRV_PRINTER<br> FileSubType = "Printer drv"<br> Case VFT2_DRV_KEYBOARD<br> FileSubType = "Keyboard drv"<br> Case VFT2_DRV_LANGUAGE<br> FileSubType = "Language drv"<br> Case VFT2_DRV_DISPLAY<br> FileSubType = "Display drv"<br> Case VFT2_DRV_MOUSE<br> FileSubType = "Mouse drv"<br> Case VFT2_DRV_NETWORK<br> FileSubType = "Network drv"<br> Case VFT2_DRV_SYSTEM<br> FileSubType = "System drv"<br> Case VFT2_DRV_INSTALLABLE<br> FileSubType = "Installable"<br> Case VFT2_DRV_SOUND<br> FileSubType = "Sound drv"<br> Case VFT2_DRV_COMM<br> FileSubType = "Comm drv"<br> Case VFT2_UNKNOWN<br> FileSubType = "Unknown"<br> End Select<br> Case VFT_FONT<br> FileType = "Font"<br> Select Case udtVerBuffer.dwFileSubtype<br> Case VFT_FONT_RASTER<br> FileSubType = "Raster Font"<br> Case VFT_FONT_VECTOR<br> FileSubType = "Vector Font"<br> Case VFT_FONT_TRUETYPE<br> FileSubType = "TrueType Font"<br> End Select<br> Case VFT_VXD<br> FileType = "VxD"<br> Case VFT_STATIC_LIB<br> FileType = "Lib"<br> Case Else<br> FileType = "Unknown"<br> End Select<br> Form2.Show 1<br>End Sub<br><br>Private Sub Drive1_Change()<br> Dir1.Path = Drive1.Drive<br> File1.Path = Dir1.Path<br> Label1(2).Caption = File1.Path<br>End Sub<br><br>Private Sub File1_Click()<br> Text1.Text = File1.List(File1.ListIndex)<br>End Sub<br><br>Private Sub File1_DblClick()<br> DisplayVerInfo<br>End Sub<br><br>Private Sub File1_PathChange()<br> Text1.Text = "*.*"<br> File1.Pattern = "*.*"<br>End Sub<br><br>Private Sub Form_Load()<br> Dim Buffer As String<br> Dim rc As Long<br><br> ' **** Set Default Dir to Windows System Subdirectory ****<br> Buffer = Space$(256)<br> rc = GetSystemDirectory(Buffer, Len(Buffer))<br> Buffer = LCase$(Mid$(Buffer, 1, InStr(Buffer, Chr(0)) - 1))<br> Dir1.Path = Buffer<br> File1.Path = Buffer<br> Drive1.Drive = Left$(Buffer, 1)<br>End Sub<br><br>Private Sub Form_Unload(Cancel As Integer)<br> End<br>End Sub<br><br>Private Sub Text1_KeyPress(KeyAscii As Integer)<br> If KeyAscii = 13 Then<br> File1.Pattern = Text1.Text<br> KeyAscii = 0<br> If File1.ListCount = 1 Then DisplayVerInfo<br> If File1.ListCount = 0 Then<br> MsgBox "Invalid Filename"<br> File1.Pattern = "*.*"<br> Text1.Text = "*.*"<br> End If<br> File1.SetFocus<br> End If<br>End Sub <br><br><br>VERINFO2.FRM<br>' The following is a text dump of the form VERINFO2. It includes the form<br>' and control description as well as necessary Function and Sub procedures.<br>' Save the code in a single text file called VERINFO2.FRM and you can then<br>' load it as a form in Visual Basic.<br>'<br>VERSION 4.00<br>Begin VB.Form Form2<br> Appearance = 0 'Flat<br> BackColor = &H80000005&<br> BorderStyle = 1 'Fixed Single<br> Caption = "File Version Info"<br> ClientHeight = 3345<br> ClientLeft = 6630<br> ClientTop = 2175<br> ClientWidth = 4500<br> ForeColor = &H80000008&<br> Height = 3810<br> Left = 6540<br> LinkMode = 1 'Source<br> LinkTopic = "Form3"<br> MaxButton = 0 'False<br> MinButton = 0 'False<br> ScaleHeight = 13.937<br> ScaleMode = 4 'Character<br> ScaleWidth = 37.5<br> Top = 1800<br> Width = 4680<br> Begin VB.CommandButton Command1<br> Appearance = 0 'Flat<br> BackColor = &H80000005&<br> Caption = "OK"<br> BeginProperty Font<br> name = "MS Sans Serif"<br> charset = 0<br> weight = 700<br> size = 8.25<br> underline = 0 'False<br> italic = 0 'False<br> strikethrough = 0 'False<br> EndProperty<br> Height = 372<br> Left = 1680<br> TabIndex = 0<br> Top = 2880<br> Width = 1452<br> End<br>End<br>Attribute VB_Name = "Form2"<br>Attribute VB_Creatable = False<br>Attribute VB_Exposed = False<br>Private Sub Command1_Click()<br> Form2.Hide<br>End Sub<br><br>Private Sub Command1_GotFocus()<br> Form_Paint<br>End Sub<br><br>Private Sub Form_Paint()<br> Form2.CurrentX = 2<br> Form2.CurrentY = 1<br> Form2.Print "FileName:"<br> Form2.CurrentX = 2<br> Form2.Print "Directory:"<br> Form2.CurrentX = 2<br> Form2.Print "File Version:"<br> Form2.CurrentX = 2<br> Form2.Print "Product Version:"<br> Form2.CurrentX = 2<br> Form2.Print "File Flags:"<br> Form2.CurrentX = 2<br> Form2.Print "File OS:"<br> Form2.CurrentX = 2<br> Form2.Print "File Type:"<br> Form2.CurrentX = 2<br> Form2.Print "File Sub-type:"<br><br> Form2.CurrentX = 18<br> Form2.CurrentY = 1<br> Form2.Print Filename<br> Form2.CurrentX = 18<br> Form2.Print Directory<br> Form2.CurrentX = 18<br> Form2.Print FileVer<br> Form2.CurrentX = 18<br> Form2.Print ProdVer<br> Form2.CurrentX = 18<br> Form2.Print FileFlags<br> Form2.CurrentX = 18<br> Form2.Print FileOS<br> Form2.CurrentX = 18<br> Form2.Print FileType<br> Form2.CurrentX = 18<br> Form2.Print FileSubType<br>End Sub <br><br><br>How to Create and Run the Program<br>Start Visual Basic. Form1 is created by default. <br><br><br>From the File menu, choose Remove File to remove Form1. <br><br><br>From the File menu, choose Add File to add VERINFO.BAS. <br><br><br>Repeat step 3 to add VERINFO1.FRM and VERINFO2.FRM to the project. <br><br><br>From the Options menu, choose Project and set Start Up Form to Form1. <br><br><br>Run the application.<br></font> <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href=
</a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)