'[DllImport("mscoree.dll", CharSet = CharSet.Unicode)]
'private static extern int GetFileVersion
' (string path, StringBuilder buffer, int buflen, out int written);
Private Declare Function GetFileVersion Lib "mscoree.dll" ( _
ByVal path As Long, _
ByVal buf As String, _
bufLen As Long, _
ByRef cb As Long _
) As Long
Private Sub Form_Load()
Dim exe As String
Dim buf As String
Dim cb As Long
Dim ret As Long
buf = String(255, 0)
exe = "d:\anycpu.exe" & Chr(0) 'api requires a unicode string...
ret = GetFileVersion(StrPtr(exe), buf, Len(buf), cb)
If cb > 0 Then
buf = Mid(buf, 1, (cb * 2))
buf = StrConv(buf, vbFromUnicode, &H409)
End If
Debug.Print "ret=" & Hex(ret) & " cb=" & cb & " buf=" & Replace(buf, " ", 0)
End Sub