473,383 Members | 1,877 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,383 software developers and data experts.

adding a COM dll as reference during runtime

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

Jul 5 '07 #1
5 2809
Hello sh*****@gmail.com,

Use the LoadLibrary/GetProcAddress or reflection http://www.codeproject.com/csharp/dy...select=1008486

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
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

Jul 5 '07 #2
>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

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jul 5 '07 #3
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?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<sh*****@gmail.comwrote in message
news:11**********************@q69g2000hsb.googlegr oups.com...
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

Jul 5 '07 #4
Michael Nemtsev wrote:
Hello sh*****@gmail.com,
>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?
Use the LoadLibrary/GetProcAddress or reflection
http://www.codeproject.com/csharp/dy...select=1008486
For a COM DLL also ?

Arne
Jul 5 '07 #5
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

*** Sent via Developersdex http://www.developersdex.com ***
Jul 9 '07 #6

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

Similar topics

9
by: Amir Dekel | last post by:
Hi everyone, I have two problems: 1. How can I keep my changes in sys.path after closing the interpreter? 2. os.path.expanduser("~") always gives me "C:\\" instead of my homepath. I have...
8
by: filip stas | last post by:
How do i add references during runtime?
2
by: manohar.shankar | last post by:
Hi, I have been searching on this topic for quite sometime and didnt get any answer. Is there a way I can extend/add methods/properties to a C# class during runtime. eg., I have class:...
4
by: rushikesh.joshi | last post by:
Hi All, I have created my own WebControl and want to add it in my aspx page at runtime. it's compiling perfectly, but when i m going to execute, it gives me error of "Object reference not set...
4
by: krishm | last post by:
hi i have a COM dll and i want to access the methods in the dll through my program. but i need to add that dll as reference during runtime and not the way references are generally added...
0
by: krishm | last post by:
hi all i have a problem to which i cant find a way out I have a COM dll which i want to add as a reference during runtime and not like it is done (project>>add reference>>com) can anybody...
8
by: Jason | last post by:
Hello, I am trying to utilitze the AJAX Control toolkit in my asp.net project. I have added a reference to AjaxControlToolkit.dll, and in my page, added these lines of code: ...
5
by: DBC User | last post by:
I have a situation, where I need to add 4 or 5 data files (they change every time I build) in my project during build time and somehow I need a way to access these files during runtime. So I have...
7
by: chage | last post by:
Hi, I have been searching around to try adding reference assembly to another assembly during runtime, programatically. Is this possible in .Net? The reason for this is because i am having...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: 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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.