473,399 Members | 3,106 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,399 software developers and data experts.

DLL Type.

I am writing an application that will read through a directory of files and
create a release manifest. Basically a document that captures information
about the files. Such as date created, version, etc. I would also like to
determine if the file is a COM object that will need to be registered. Does
anyone know of a way in C# that you can look at a file and determine if it is
in fact a COM object?

Thanks for your help!

Sam
May 24 '06 #1
5 1504
Sam,

DLLs are not COM objects, they just host COM objects. What you could do
is load the dll using LoadLibrary, then look for the DllRegisterServer
function to be exported. This is used by the OS to register COM dll's with
the system.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sam Davis" <Sa******@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
I am writing an application that will read through a directory of files and
create a release manifest. Basically a document that captures information
about the files. Such as date created, version, etc. I would also like to
determine if the file is a COM object that will need to be registered.
Does
anyone know of a way in C# that you can look at a file and determine if it
is
in fact a COM object?

Thanks for your help!

Sam

May 24 '06 #2
Thanks! I think I figured out how to do it..

System.Object obj;
LoadTypeLibEx(strFile, RegKind.RegKind_None, out obj);
if(obj == null)
return false;
else
return true;

Do you see any issues with this? It seemed to pick out the dll's that hosted
com objects.

Thanks!

"Nicholas Paldino [.NET/C# MVP]" wrote:
Sam,

DLLs are not COM objects, they just host COM objects. What you could do
is load the dll using LoadLibrary, then look for the DllRegisterServer
function to be exported. This is used by the OS to register COM dll's with
the system.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sam Davis" <Sa******@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
I am writing an application that will read through a directory of files and
create a release manifest. Basically a document that captures information
about the files. Such as date created, version, etc. I would also like to
determine if the file is a COM object that will need to be registered.
Does
anyone know of a way in C# that you can look at a file and determine if it
is
in fact a COM object?

Thanks for your help!

Sam


May 24 '06 #3
Sam,

That should work just fine as well. Make sure that you pass obj to the
static ReleaseComObject on the Marshal class.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sam Davis" <Sa******@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
Thanks! I think I figured out how to do it..

System.Object obj;
LoadTypeLibEx(strFile, RegKind.RegKind_None, out obj);
if(obj == null)
return false;
else
return true;

Do you see any issues with this? It seemed to pick out the dll's that
hosted
com objects.

Thanks!

"Nicholas Paldino [.NET/C# MVP]" wrote:
Sam,

DLLs are not COM objects, they just host COM objects. What you could
do
is load the dll using LoadLibrary, then look for the DllRegisterServer
function to be exported. This is used by the OS to register COM dll's
with
the system.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sam Davis" <Sa******@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
>I am writing an application that will read through a directory of files
>and
> create a release manifest. Basically a document that captures
> information
> about the files. Such as date created, version, etc. I would also like
> to
> determine if the file is a COM object that will need to be registered.
> Does
> anyone know of a way in C# that you can look at a file and determine if
> it
> is
> in fact a COM object?
>
> Thanks for your help!
>
> Sam


May 24 '06 #4
Thanks! I think I figured out how to do it..

System.Object obj;
LoadTypeLibEx(strFile, RegKind.RegKind_None, out obj);
if(obj == null)
return false;
else
return true; Do you see any issues with this? It seemed to pick out the dll's that hosted
com objects.

It will select the DLLs that contain type library resources, which
many COM libraries do, but not all. And even if it has such a
resource, the DLL doesn't have to be the one hosting the COM classes.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
May 24 '06 #5
I would like to expose a method that returns a dataset.

Is there something I need to do to achieve that so that the webpage using
VBScript can catch the returned dataset?

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Thanks! I think I figured out how to do it..

System.Object obj;
LoadTypeLibEx(strFile, RegKind.RegKind_None, out obj);
if(obj == null)
return false;
else
return true;

Do you see any issues with this? It seemed to pick out the dll's that
hosted
com objects.

It will select the DLLs that contain type library resources, which
many COM libraries do, but not all. And even if it has such a
resource, the DLL doesn't have to be the one hosting the COM classes.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Jun 29 '06 #6

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

Similar topics

21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
6
by: S.Tobias | last post by:
I'm trying to understand how structure type completion works. # A structure or union type of unknown # content (as described in 6.7.2.3) is an incomplete type. It # is ...
0
by: Chris Fink | last post by:
When I am consuming a webservice, an object has an undefined value (inq3Type.Call3Data). I do not completely understand why this is happening and apologize for the vague question. My assumption...
1
by: Rob Griffiths | last post by:
Can anyone explain to me the difference between an element type and a component type? In the java literature, arrays are said to have component types, whereas collections from the Collections...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Languageâ€, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
3
by: john | last post by:
Hi to All To demonstrate: public class MyBaseGenericClass<T> { } public class MyGenericClass1<T: MyBaseGenericClass<T> {
7
by: Sky | last post by:
I have been looking for a more powerful version of GetType(string) that will find the Type no matter what, and will work even if only supplied "{TypeName}", not the full "{TypeName},{AssemblyName}"...
9
by: weirdwoolly | last post by:
Hopefully someone will be able to help. I have written a stored procedure in C++ called from a Java test harness to validate the graphic data types in C++ and their use. I have declared the...
5
by: JH | last post by:
Hi I found that a type/class are both a subclass and a instance of base type "object". It conflicts to my understanding that: 1.) a type/class object is created from class statement 2.) a...
3
by: amanjsingh | last post by:
Hi, I am trying to implement Java Web Service using Apache Axis2 and Eclipse as a tool. I have created the basic code and deployed the service using various eclipse plugin but when I try to invoke...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.