adding a COM dll as reference during runtime


S

shubhlu

hi

I have a problem that I have a COM dll and i need to access the
methods in that dll. But what is required here is that the dll needs
to be added as a reference only during runtime and not like they are
generally added (Project-->Add Reference-->COM). Is it possible to do
that?

Please help me out on this matter.

Thanks and regards

krish
 
Ad

Advertisements

M

Mattias Sjögren

I have a problem that I have a COM dll and i need to access the
methods in that dll. But what is required here is that the dll needs
to be added as a reference only during runtime and not like they are
generally added (Project-->Add Reference-->COM). Is it possible to do
that?

Well a reference is by definition a compile time thing. But you can
certainly instantiate COM objects dynamically at runtime and call them
assuming they support late binding with IDispatch.

Use Type.GetTypeFromProgID/CLSID to find the COM type, instantiate
with Activator.CreateInstance and call its methods using reflection
(Type.InvokeMember etc).


Mattias
 
N

Nicholas Paldino [.NET/C# MVP]

krish,

I am kind of curious why you think you can't add a reference at
compile-time. What is it that prevents you from doing so?
 
Ad

Advertisements

K

krishnendu mukherjee

hi nicholas

thnx a lot for answering back

actually i am a beginner so am not very sure wat exactly is the problem
anyways can u plz do me the favour of explaining how to add a COM dll
during runtime. if u can plz send me some code snippet as example

thnks and regards

krish
 
Ad

Advertisements


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