[AccessD] Missing references

Jim Dettman jimdettman at verizon.net
Tue Feb 20 09:11:23 CST 2007


Shamil,

<<When an object is created in memory, COM returns a pointer to its IUnknown
interface, whose QueryInterface() function VB then uses to locate a given
interface. All objects include the IUnknown interface, while only objects
capable of late-binding support the IDispatch interface. >>

  Thanks for that site.  I tried hunting for a bit yesterday to find
something that specifically stated that when you create an object with a SET
statement, the only thing that happens is that you get a pointer to the COM
object.  The above statement from the site you pointed out states exactly
that.

  It's as I remembered it; each property/method reference must make a call
to lookup the functions address.  Those may be cached somewhere, but the
calls are made each and every time.

Jim. 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil
Salakhetdinov
Sent: Monday, February 19, 2007 4:04 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Missing references

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
 


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list