|
-
Aug 4th, 2013, 08:57 PM
#8
Re: VB6 with DLL
 Originally Posted by Nightwalker83
What is the difference between an ActiveX DLL and a normal DLL, what is activeX and why does it need to be registered?
ActiveX DLLs are actually COM servers. They export services through interfaces. Now COM was meant to be a cure for DLL hell or some such thing. Weather it brought more problems than it solved is debatable, non-the-less, the approach they took was to require all COM classes(I believe co-classes is the correct technical jargon), interfaces and methods to all be identified by GUIDs to ensure uniqueness. This way you can have multiple versions of a single COM server existing side by side without problems because the COM clients would be bound against the IDs of whatever version it was compiled against. Every time you compile an ActiveX DLL, new IDs are generated for the interfaces, classes, and methods.
Now, all this information about the ActiveX DLLs interfaces is stored in something called a type library. They can either be embedded inside the DLL or separately in a .TLB file. Now when you register an ActiveX DLL, what happens is that the information about the classes and interfaces is written into the registry, otherwise COM clients would not be able to find them. When you compile a VB6 program that uses a COM interface like say, IPicture, its not actually binding to something called IPicture but rather an interface ID. The IID for IPicture is 7BF80980-BF32-101A-8BBB-00AA00300CAB. That is what your VB6 app looks for whenever you call on IPicture. That is how COM actually works. Using names is only a convenience for the programmer writing and/or using the interface. COM doesn't care about interface names, only IDs.
Another thing you should note is that typically registration is done by the ActiveX DLL itself. When you compile an ActiveX DLL in VB6 it actually exports two C style methods, DllRegisterServer and DllUnregisterServer. What actually happens when you call Regsvr32 on ActiveX DLLs is that it calls one of these functions depending on weather you're registering or unregistering it.
Last edited by Niya; Aug 4th, 2013 at 09:02 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|