Shamil Salakhetdinov
shamil at users.mns.ru
Mon Feb 19 15:03:46 CST 2007
Hi Everyone, Please have a look here: http://www.fredshack.com/docs/com.html << - Objects can be accessed in two modes: Early bound (the EXE can compile direct function calls by looking up the address of the method in the vtable array of pointers to functions), or late bound (the EXE go through the IDispatch interface to locate functions). Early binding is recommended for performance reasons, since calls are made directly to the ad hoc interface, while with late binding, calls are made through the IDispatch interface which can determine the methods and properties of the object at runtime. - Marshaling is the process of collecting the necessary information for an EXE to call a COM object that lives outside of the memory space of the calling EXE, since 32-bit versions of Windows keep the two processes separate - Marshaling isn't required if the COM server lives in the same address space as the calling EXE, but is required if the COM server is itself an EXE, and, thus, lives in a different address space. The COM EXE can run on either the same computer as the caller EXE, or on a remote computer, in which case the technology called Distributed Component Object Model (DCOM) is used - In Visual Basic you can implement early binding by adding a reference to an object via the references dialog box, then declaring a variable using the specific object type instead of As Object. This can substantially reduce the time it takes to access methods and properties in the object - Late binding occurs in Visual Basic when you dimension an object variable to be As Object. An object variable can hold any type of object. Since the variable can reference any object and must support whatever methods or properties that object may implement, it clearly can have no way of knowing until runtime what those methods and properties may be. Without late binding and the IDispatch Interface, the As Object type of variable would not be possible - OLE Automation ("Automation" for short) is the late-bound way of calling an object, and thus, relies on the existence of an IDispatch for this interface - The IDispatch interface consists of the following functions: GetTypeInfoCount(), GetTypeInfo(), GetIDsOfNames(), Invoke() Each method or property supported by an interface has a dispatch ID - a number that identifies that method or property. Thus, while each method has its own dispatch ID, the function to set a property and the function to retrieve that same property will share the same dispatch ID >> -- Shamil