Jason W563203

I'd like to gather some information from a DLL file (hal.dll). I know that it is in the properties for the DLL file, and it's the item "Internal Name". I'd like to query that with Visual Basic and post it into a Windows Form. Does anyone have any suggestions on strings to query that

Thanks much in advance!




Re: Visual Basic General Get information from DLL, Internal name field, using Visual Basic 2005

Bruno Yu - MSFT

Anonymous,

Please use the AssemblyName.GetAssemblyName Method and try the following code:

Code Snippet

Imports System

Imports System.Reflection

Imports System.Text.RegularExpressions

Imports Microsoft.VisualBasic

Public Class AssemblyName_GetAssemblyName

Public Shared Sub Main()

' Get the type of 'System.Object'.

Dim myType As Type = GetType(System.Object)

' Get the path of 'System.dll'.

Dim system As String = Regex.Replace(myType.Assembly.CodeBase, "mscorlib.dll", "System.dll")

system = Regex.Replace(system, "file:///", "")

' Get the assembly information and display to the console.

Dim myAssemblyName As AssemblyName = AssemblyName.GetAssemblyName(system)

Console.WriteLine(ControlChars.Cr + "Displaying the assembly information of 'System.dll'" + ControlChars.Cr)

Console.WriteLine(myAssemblyName.ToString())

End Sub 'Main

End Class 'AssemblyName_GetAssemblyName






Re: Visual Basic General Get information from DLL, Internal name field, using Visual Basic 2005

Anonymous

Thank you, I'll have to add this to my code and try it out.





Re: Visual Basic General Get information from DLL, Internal name field, using Visual Basic 2005

Anonymous

I had some issues with that code, so I found and integrated this, but even if I manually put the hal.dll file into the debug folder, I still get an error that the file couldn't be found. Here's my code (with some parts obviously that aren't relevant). Any ideas Again the file I want info from is:

c:\windows\system32\hal.dll

The informaiton I'm seeking is "internal name" which happens to be the same as the "original file name" as well.

Again any help would be much appreciated.

-Jason

Code Snippet

Imports System

Imports System.Net

Imports System.Net.NetworkInformation

Imports System.Diagnostics.Process

Imports System.Reflection

Imports System.Text.RegularExpressions

Imports Microsoft.VisualBasic

Public Class DCA

Private Sub DCA_Layout(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LayoutEventArgs) Handles MyBase.Layout

Dim myAssemblyName As AssemblyName = AssemblyName.GetAssemblyName("hal.dll")

Me.tbHALVersion.Text = myAssemblyName.ToString()

End Sub

End Class