Solved

Getting information about DLL

Posted on 2002-07-10
22
219 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
z = x + y – 1 6 67
Specify ip address in my connection string for sas 2 52
Sending a email via excel using vba 6 71
Problem to With line 4 37
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

929 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