Link to home
Start Free TrialLog in
Avatar of slavikn
slavikn

asked on

Getting information about DLL

Hello,

How can I get information about a DLL files: comments, compayname, internal name, language, etc?
Avatar of rpai
rpai

You could use the App object to retrieve the DLL information. i.e App.Comments ; App.CompanyName ; App.Title

While you are here, please update your other questions:-
Questions Asked 18
Last 10 Grades Given A A A A A A A A A A  
Question Grading Record 13 Answers Graded / 13 Answers Received

Thanks!
Avatar of slavikn

ASKER

> You could use the App object to retrieve the DLL information.
How do I do that?


> While you are here, please update your other questions.
What do you mean? There are still unanswered questions.
Simply use this:-
Debug.Print App.Comment & vbtab & App.CompanyName
in your DLL whose Comments and CompanyName you wish to find.
Hope that answers your question.
Please use the above statement only when running in the debug mode so that you see what is returned by App.Comment
and other properties

"While you are here, please update your other questions:-
Questions Asked 18 "

That's not a bad record, rpai.
Only 5 open questions: 1 in CS, 3 from yesterday and today, and 1 which was self-resolved dating less than a month ago.
Avatar of slavikn

ASKER

I was not clear. Sorry. I mean that I have a DLL file (somewhere). From my VB application I want to read information about that DLL file.

How can I do it?
slavikn, Do you have access to the DLL?
So within the DLL you can create you own Public Methods.
For instance your DLL has ProgID myProj.myCls.

Within myProj.myCls you could write:-
-------------------DLL Component---------------------------
Public Function GetCommentInfo()as String
   App.Comment
End Function

Public Function GetCompanyName()as String
   App.CompanyName
End Function

'-- And so on
-------------------End DLL Component-----------------------


Now when you call the DLL from your application, you could easily retrieve the details:-
-------------------Test Application------------------------
Dim objDLL As Object
Dim sComments As String
Dim sCompanyName As String

Set objDLL =  CreateObject("myProj.myCls")
sComments = objDLL.GetCommentInfo
sCompanyName = objDLL.GetCompanyName
'-- And so on
-------------------End Test Application--------------------

Cheers!
Avatar of slavikn

ASKER

I don't have access to the DLL.
You did not specify that you wish to get the information of the 'remote' DLL in your original question!!
I am not sure if there a way to accomplish this if you cannot access the DLL. Sorry I cannot help you further!
Avatar of slavikn

ASKER

I can access it. It is on my computer. I mean that I cannot modify it. Ok?
Avatar of Richie_Simonetti
You could modify it but not with VB. You could use an external tool (excellent Borland Resource workshop)
What info do you want to change?
Avatar of slavikn

ASKER

I wasn't clear again. I want to give my VB application to people and they will use it to read a specific DLL's information.
You could show properties dialog box, is it enought?

Option Explicit
Private Type SHELLEXECUTEINFO
    cbSize As Long
    fMask As Long
    hWnd As Long
    lpVerb As String
    lpFile As String
    lpParameters As String
    lpDirectory As String
    nShow As Long
    hInstApp As Long
    lpIDList As Long
    lpClass As String
    hkeyClass As Long
    dwHotKey As Long
    hIcon As Long
    hProcess As Long
  End Type
 
  Private Declare Function ShellExecuteEx Lib "shell32" (lpSEI As SHELLEXECUTEINFO) As Long
 
  Private Const SEE_MASK_INVOKEIDLIST = &HC
 
  Private Sub Form_Click()
    Call ShowFileProperties( _
      "c:\winnt\system32\msvbvm60.dll")
  End Sub
 
  Private Sub ShowFileProperties(ByVal aFile As String)
    Dim sei As SHELLEXECUTEINFO
    sei.hWnd = Me.hWnd
    sei.lpVerb = "properties"
    sei.lpFile = aFile
    sei.fMask = SEE_MASK_INVOKEIDLIST
    sei.cbSize = Len(sei)
    ShellExecuteEx sei
  End Sub
If you need only the Version Information of the DLL then
you could use something like this:-

----------------BEGIN TEST APP----------------------------
Option Explicit

Private Type VS_FIXEDFILEINFO
    dwSignature As Long
    dwStrucVersion As Long
    dwFileVersionMSl As Integer
    dwFileVersionMSh As Integer
    dwFileVersionLSl As Integer
    dwFileVersionLSh As Integer
    dwProductVersionMSl As Integer
    dwProductVersionMSh As Integer
    dwProductVersionLSl As Integer
    dwProductVersionLSh As Integer
    dwFileFlagsMask As Long
    dwFileFlags As Long
    dwFileOS As Long
    dwFileType As Long
    dwFileSubtype As Long
    dwFileDateMS As Long
    dwFileDateLS As Long
End Type

Private Declare Function GetFileVersionInfo _
    Lib "Version.dll" Alias _
    "GetFileVersionInfoA" (ByVal lptstrFilename _
    As String, ByVal dwHandle As Long, ByVal _
    dwLen As Long, lpData As Any) As Long

Private Declare Function _
    GetFileVersionInfoSize Lib "Version.dll" _
    Alias "GetFileVersionInfoSizeA" (ByVal _
    lptstrFilename As String, lpdwHandle As _
    Long) As Long

Private Declare Sub CopyMemory Lib "kernel32" _
    Alias "RtlMoveMemory" (dest As Any, src As _
    Long, ByVal length As Long)

Private Declare Function VerQueryValue Lib _
    "Version.dll" Alias "VerQueryValueA" _
    (pBlock As Any, ByVal lpSubBlock As String, _
    lplpBuffer As Any, puLen As Long) As Long

Public Function GetVersionInfo(ByVal sFile As _
    String) As String

    Dim lDummy As Long
    Dim sBuffer() As Byte
    Dim lBufferLen As Long, lVerPointer As Long
    Dim lVerBufferLen As Long
    Dim udtVerBuffer As VS_FIXEDFILEINFO
   
    'Default return value
    GetVersionInfo = "N/A"
   
    'Attempt to retrieve version resource
    lBufferLen = GetFileVersionInfoSize(sFile, _
    lDummy)
   
    If lBufferLen > 0 Then
       
        ReDim sBuffer(lBufferLen)
       
        If GetFileVersionInfo(sFile, 0&, _
            lBufferLen, sBuffer(0)) <> 0 Then
           
            If VerQueryValue(sBuffer(0), _
                "\", lVerPointer, lVerBufferLen) _
                <> 0 Then
       
                CopyMemory udtVerBuffer, ByVal _
                    lVerPointer, Len(udtVerBuffer)
                   
                With udtVerBuffer
                    GetVersionInfo = _
                        .dwFileVersionMSh & "." & _
                        .dwFileVersionMSl & "." & _
                        .dwFileVersionLSh & "." & _
                        .dwFileVersionLSl
                End With
       
            End If
        End If
    End If

End Function

Private Sub Command1_Click()
Debug.Print GetVersionInfo("C:\myPath\myTest.dll")
End Sub
------------------END TEST APP----------------------------
Avatar of slavikn

ASKER

Richie_Simonetti,
A dialog is not enough. I want to show it in my own window.

rpai,
I need all the information which is available from the "Version" tab in the file's properties.

Avatar of slavikn

ASKER

Points: 20 >> 23. I hope this will encourage you  :-)
ASKER CERTIFIED SOLUTION
Avatar of Richie_Simonetti
Richie_Simonetti
Flag of Argentina image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slavikn

ASKER

Thanks!
I knew that giving 3 points more will help  :-)
Thanks for "A" grade but please, don't push me
:)
Avatar of slavikn

ASKER

I was just kidding  :-)