Solved

Getting information about DLL

Posted on 2002-07-10
22
218 Views
Last Modified: 2010-05-02
Hello,

How can I get information about a DLL files: comments, compayname, internal name, language, etc?
0
Comment
Question by:slavikn
  • 9
  • 8
  • 4
  • +1
22 Comments
 
LVL 5

Expert Comment

by:rpai
Comment Utility
You could use the App object to retrieve the DLL information. i.e App.Comments ; App.CompanyName ; App.Title

0
 
LVL 5

Expert Comment

by:rpai
Comment Utility
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!
0
 
LVL 1

Author Comment

by:slavikn
Comment Utility
> 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.
0
 
LVL 5

Expert Comment

by:rpai
Comment Utility
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.
0
 
LVL 5

Expert Comment

by:rpai
Comment Utility
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

0
 
LVL 5

Expert Comment

by:rpai
Comment Utility
0
 
LVL 3

Expert Comment

by:nichia
Comment Utility
"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.
0
 
LVL 1

Author Comment

by:slavikn
Comment Utility
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?
0
 
LVL 5

Expert Comment

by:rpai
Comment Utility
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!
0
 
LVL 1

Author Comment

by:slavikn
Comment Utility
I don't have access to the DLL.
0
 
LVL 5

Expert Comment

by:rpai
Comment Utility
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!
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:slavikn
Comment Utility
I can access it. It is on my computer. I mean that I cannot modify it. Ok?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
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?
0
 
LVL 1

Author Comment

by:slavikn
Comment Utility
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.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
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
0
 
LVL 5

Expert Comment

by:rpai
Comment Utility
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----------------------------
0
 
LVL 1

Author Comment

by:slavikn
Comment Utility
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.

0
 
LVL 1

Author Comment

by:slavikn
Comment Utility
Points: 20 >> 23. I hope this will encourage you  :-)
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 23 total points
Comment Utility
0
 
LVL 1

Author Comment

by:slavikn
Comment Utility
Thanks!
I knew that giving 3 points more will help  :-)
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
Thanks for "A" grade but please, don't push me
:)
0
 
LVL 1

Author Comment

by:slavikn
Comment Utility
I was just kidding  :-)
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now