473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Programmatically Crawl a DLL's Namespacec

Hello,

In Visual Studio, one can add in a DLL as a reference. Then, using
Object Browser, one can open and browse thru the DLL's namespace and
look at its objects and functions.

Is there a way to do this programmatically? That is, to point to a
specific DLL and return its namespace as a string?

Thanks in advance,

J Wolfgang Goerlich

Aug 17 '06 #1
7 2339
jw********@gmail.com wrote:
In Visual Studio, one can add in a DLL as a reference. Then, using
Object Browser, one can open and browse thru the DLL's namespace and
look at its objects and functions.

Is there a way to do this programmatically? That is, to point to a
specific DLL and return its namespace as a string?
Imports System.Reflection

Dim asm As [Assembly] = [Assembly].LoadFile("filename.dll")

For Each t As System.Type In asm.GetTypes()
MsgBox(t.Name)
Next

This should give you a push in the right direction.

Aug 17 '06 #2
Excellent! Much obliged.
Chris Dunaway wrote:
Imports System.Reflection

Dim asm As [Assembly] = [Assembly].LoadFile("filename.dll")

For Each t As System.Type In asm.GetTypes()
MsgBox(t.Name)
Next
Aug 17 '06 #3
Hello Chris,

In addition to Chris's comments... DLLs do not have a namespace. An assembly
can participate in one or more namespaces. However a single namespace is
not constrained to a single assembly.

Also, I would suggest loading the assembly into it's own AppDomain.. AppDomains
can be unloaded. Individual assembies can not.

-Boo
jw********@gmail.com wrote:
>In Visual Studio, one can add in a DLL as a reference. Then, using
Object Browser, one can open and browse thru the DLL's namespace and
look at its objects and functions.

Is there a way to do this programmatically? That is, to point to a
specific DLL and return its namespace as a string?
Imports System.Reflection

Dim asm As [Assembly] = [Assembly].LoadFile("filename.dll")

For Each t As System.Type In asm.GetTypes()
MsgBox(t.Name)
Next
This should give you a push in the right direction.

Aug 18 '06 #4
Alright, I have [Assembly].LoadFile("filename.dll") working. Have not
yet figured out how to do the same in AppDomain, that will come.

Now, Assembly.LoadFile works for .Net Framework DLLs. But, this does
not work for other Win32 DLLs. Netapi32, for instance, which I know
contains the DsGetDcName command. When I try to load it as an Assembly,
I get:

System.BadImageFormatException: An attempt was made to load a program
with an incorrect format.

Any suggestions?

J Wolfgang Goerlich

Aug 18 '06 #5
If maMatch.Groups("BigGroup1").Success Then
value1 = maMatch.Groups("value1").ToString
value2 = maMatch.Groups("value2").ToString
Debug.WriteLine(value1)
Debug.WriteLine(value2)
ElseIf maMatch.Groups("BigGroup2").Success Then
value1 = maMatch.Groups("value1").ToString
Debug.WriteLine(value1)
End If
Aug 19 '06 #6
Hello jw********@gmail.com,

Native Win32 dlls will not ever contain .Net namespaces. In fact, there
is no concept of a namespace at all in native dlls.

If you want to interrogate native dlls look at the Win32 functions: LoadLibrary,
FreeLibrary, and their cohorts.

-Boo
Alright, I have [Assembly].LoadFile("filename.dll") working. Have not
yet figured out how to do the same in AppDomain, that will come.

Now, Assembly.LoadFile works for .Net Framework DLLs. But, this does
not work for other Win32 DLLs. Netapi32, for instance, which I know
contains the DsGetDcName command. When I try to load it as an
Assembly, I get:

System.BadImageFormatException: An attempt was made to load a program
with an incorrect format.

Any suggestions?

J Wolfgang Goerlich

Aug 19 '06 #7
Mudhead wrote:
If maMatch.Groups("BigGroup1").Success Then
value1 = maMatch.Groups("value1").ToString
value2 = maMatch.Groups("value2").ToString
Debug.WriteLine(value1)
Debug.WriteLine(value2)
ElseIf maMatch.Groups("BigGroup2").Success Then
value1 = maMatch.Groups("value1").ToString
Debug.WriteLine(value1)
End If
Please don't hijack the thread to ask your own question. This question
should be posted in its own thread.

Aug 21 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Danny | last post by:
I am trying to crawl my site to get a list of links. I am using the regular expressions to get the href tags from the pages and reading the links using xmlhttp module. is there an efficient way...
1
by: Danny | last post by:
I am trying to crawl my site to get a list of all the links. I am using the regular expressions to get the href tags from the pages and reading the source pages using xmlhttp module. Is there...
1
by: Gary Brewer | last post by:
Hi, I have a Windows Forms application stub (Admin.exe) that runs on a local machine. It loads assemblies from a website programmatically using the Assembly.LoadFrom static method. One of the...
9
by: Hardy Wang | last post by:
Hi all: I read an article from http://www.c-sharpcorner.com/Code/2003/Sept/InstallingWinServiceProgrammatically.asp about how to install a windows service programmatically. Based ont the code...
4
by: BentleyInc | last post by:
I'm trying to find a way to add a whildcard application mapping to aspnet_isapi.dll in IIS programmatically.... been looking into IIS administrator reference but didn't find the right function to...
0
by: Ramesh2006 | last post by:
Hi, The following error occurred when i programmatically compile another project from my present project. The Error: error CS0234:The type or namespace name 'Windows' does not exist in the...
1
by: =?Utf-8?B?cm9i?= | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox...
1
by: allbelonging | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox...
2
by: chris fellows | last post by:
Can someone tell me if .NET 2.0 framework has a namespace to enable project references to be changed programmatically? My C# project files are stored in source control with DLL references but I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.