Ken Ismert
KIsmert at texassystems.com
Fri Oct 28 18:26:04 CDT 2005
>>One an API note I have seen components that had COM and API >>style interfaces. I don't know if API style access is >>inherent in COM objects though. Could those developers have >>create two interfaces to the components? Jim, A COM Dll is just a Dll file with some icing: a VTable, a Type Library, and a Class Factory. The VTable holds offsets to all functions stored in the DLL. The Type Library (a separate file) describes the Objects, Members and Parameters exposed by the DLL. The Class Factory is largely generated code that handles the actual instantiation. Yeah, there's registry stuff too, but that is just support for these basic COM object pieces. But under it all, its just a plain Dll, which can be accessible with API-style Declare statements, if the designer so chooses. APIs are not a part of COM, just something that a COM Dll can support, because of its classic Windows Dll roots. Of course, if you use a COM Dll via an API, you forego major object advantages like multiple instances, constructors and destructors. At best, you might get statefulness, but you would have to treat the Dll as a static object. -Ken