Solved

Getting information about DLL

Posted on 2002-07-10
22
220 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
ID: 7143421
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
ID: 7143439
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
ID: 7143479
> 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 5

Expert Comment

by:rpai
ID: 7143582
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
ID: 7143604
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
ID: 7143627
0
 
LVL 3

Expert Comment

by:nichia
ID: 7143796
"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
ID: 7143862
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
ID: 7143883
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
ID: 7143935
I don't have access to the DLL.
0
 
LVL 5

Expert Comment

by:rpai
ID: 7143996
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
 
LVL 1

Author Comment

by:slavikn
ID: 7144115
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
ID: 7144142
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
ID: 7144176
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
ID: 7144238
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
ID: 7144306
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
ID: 7144390
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
ID: 7144394
Points: 20 >> 23. I hope this will encourage you  :-)
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 23 total points
ID: 7144465
0
 
LVL 1

Author Comment

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

Expert Comment

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

Author Comment

by:slavikn
ID: 7144648
I was just kidding  :-)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Saving history changes to sub form 4 42
Add a task in Outlook from access 11 39
How to make an ADE file by code? 11 82
IF ELSE Statement in Excel Macro VBA 16 62
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

815 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

10 Experts available now in Live!

Get 1:1 Help Now