Information About

Idispatch




It derives from IUnknown and offers an additional four Methods . In addition to the IUnknown methods: ''AddRef'', ''Release'', ''QueryInterface'' it implements ''GetTypeInfoCount'', ''GetTypeInfo'', ''GetIDsOfNames'' and ''Invoke''.

The Automation (IDispatch) interface allows a client application to find out what properties and methods are supported by an object at run-time. It also provides how to invoke these properties and methods. Client applications do not need to be aware of the object members when they are compiled. This allows COM and ActiveX objects to be called by scripting programs platforms such as the ASP server and Javascript on Internet Explorer , where calling conventions are not known at the time class="copylinks">IIS Or [[IE were built. By contrast, a simple object library is compiled and linked into a program, while a DLL call also needs to know a function name and parameters at compile time. Similarly, .NET assemblies do not replace the function of IDispatch and COM since any functions called from a program must be known at compile time, .

A script writer can ask the COM object for a method or property
it already knows about from documentation. Then, the client can execute the function with Invoke provided by the IDispatch interface, a form of late-binding. This sort of capability was
also supported by Dynamic Data Exchange (DDE), which never became popular because of its low level.

It is flexible, but suffers from the overhead of checking validity of method and parameters at run time.


EXTERNAL LINKS