How do I register and non .net dll in a .net enviroment?

G

Guest

Hello,

How do I register and non .net dll(with the OS) in a .net enviroment? I
have a third party dll I need to register(REGSVR32.EXE). What is the best
approach to this in a .Net enviroment. I appreciate any help.
 
R

Richard Grimes

Todd said:
Hello,

How do I register and non .net dll(with the OS) in a .net enviroment?
I have a third party dll I need to register(REGSVR32.EXE). What is
the best approach to this in a .Net enviroment. I appreciate any
help.

We need more information.

You say that it is a non-.NET DLL, so that means it may be a COM server,
or it may be a DLL. If it is a COM server then regsvr32 will register it
with the system and if you have a type library for this server
(typically it is bound as a resource to the DLL) you'll be able to use
COM interop to call it from .NET.

If the DLL is not a COM server then you cannot 'register' it. Instead
you have to put it in the PATH, or better, put it in your application's
folder. To call the functions in such a DLL you have to use platform
invoke in .NET.

To tell if it is a COM server use dumpbin /exports or depends to see if
the DLL exports the GetClassObject function. If it doesn't, then it is
not a COM server.

Richard
 
A

Atul

You can invoke regsvr32.exe and pass the dll as the command line parameter.
Use Process.Start to invoke regsvr32

----------------
-Atul, Sky Software http://www.ssware.com
Shell MegaPack For .Net & ActiveX
Windows Explorer GUI Controls
&
Quick-Launch Like Appbars, MSN/Office2003 Style Popups,
System Tray Icons and Shortcuts/Internet Shortcuts
 
G

Guest

Richard,

It is a Com Server and I was looking for a code example of how to register
it in .Net. I am new to .Net .
 
A

Atul

Process.Start(Path.Combine(Environment.SystemDirectory ,
"regsvr32.exe"),"{Path to COM dll file}");



----------------
-Atul, Sky Software http://www.ssware.com
Shell MegaPack For .Net & ActiveX
Windows Explorer GUI Controls
&
Quick-Launch Like Appbars, MSN/Office2003 Style Popups,
System Tray Icons and Shortcuts/Internet Shortcuts
----------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top