Janus said:
Hello
This is a very basic question i know :O)
Formerly I developed in VisualBasic 6.0 and when a project is started you
can select different project types.
But what exactly is an ActiveX DLL? - Is it considered as a COM object?
I've heard something about its not a real dll because of the iUnknown, but
what's that?
Im sorry for my lack of knowledge, but if someone could give me a quick
primer I would be very happy
Okay, this is a very basic overview, but it should help get you started:
A 'traditional' DLL is the Windows sense is a flat library that exports some
functions. There is no sense of object orientation really, although you can
actually export classes in a DLL through C++, but let's not go into that.
Most DLLs are just global functions, no classes or objects.
Microsoft Component Object Model (COM) is a set of rules on binaries
determining how they communicate. This communication happens between COM
objects, and is done via well defined interfaces. A component class
(coclass) must implement one or more interfaces. All interfaces derive from
IUnknown, so every coclass at least implements IUnknown. IUnknown defines
three methods: AddRef, Release and QueryInterface. The last one lets you
access the other interfaces an object exposes. The first two deal with
reference counting, which is how an object's lifetime is governed in COM.
Every time a reference is added, a counter is incremented. When the
reference is released, the counter is decremented. When the counter reaches
zero, the object is destroyed. All objects in VB6 are COM objects, but all
the details of that are abstracted away. Objects in VB.NET (and .Net in
general) are not COM objects, they are .Net objects (duh! ^_^). Their
lifetime is governed by Garbage Collection, not reference counting.
COM servers can reside in several types of files. The most common type of
COM server in an In-Process Server. This is a DLL that is loaded in the
process of the client application (hence the name in-process). They are real
DLLs, but to get at their full functionality you need to use COM, not just
traditional DLL techniques. A COM DLL typically still exports at least two
methods, used to access the coclasses in the DLL.
ActiveX is a technology built on COM. An ActiveX object is a COM object that
follows certain conventions. It for instance will always support Automation,
which means it supports the IDispatch interface next to IUnknown.
An ActiveX DLL is not a COM object. An ActiveX DLL is a DLL defining ActiveX
objects. ActiveX objects are COM objects.
I hope that answers your question.