All Topics  
IDispatch

 

   Email Print
   Bookmark   Link






 

IDispatch



 
 
IDispatch is the interface
Interface (computer science)

Interface generally refers to an Abstraction_%28computer_science%29 that an entity provides of itself to the outside. This separates the methods of external communication from internal operation, and allows it to be internally modified without affecting the way outside entities interact with it, as well as provide Polymorphism in object-orien...
 that exposes the OLE Automation
OLE Automation

In Microsoft Windows applications programming, OLE Automation , is an inter-process communication mechanism based on Component Object Model that was intended for use by scripting languages – originally Visual Basic – but now are used by languages run on Windows....
 protocol. It is one of the standard interfaces that can be exposed by COM
Component Object Model

Component Object Model is an interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages....
 objects. The I in IDispatch refers to interface. COM distinguishes between three interface types: custom, dispatch and dual interfaces.

IDispatch derives from IUnknown
IUnknown

In programming, the IUnknown interface is the fundamental interface in the Component Object Model . The published mandates that COM objects must minimally implement this interface....
 and extends its set of three methods
Method (computer science)

In object-oriented programming, a method is a subroutine that is exclusively associated either with a class or with an object . Like a procedure in procedural programming languages, a method usually consists of a sequence of statement to perform an action, a set of input parameter to customize those actions, and possibly an output value...
 (AddRef, Release and QueryInterface) with an additional four methods – 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.






Discussion
Ask a question about 'IDispatch'
Start a new discussion about 'IDispatch'
Answer questions from other users
Full Discussion Forum



Encyclopedia


IDispatch is the interface
Interface (computer science)

Interface generally refers to an Abstraction_%28computer_science%29 that an entity provides of itself to the outside. This separates the methods of external communication from internal operation, and allows it to be internally modified without affecting the way outside entities interact with it, as well as provide Polymorphism in object-orien...
 that exposes the OLE Automation
OLE Automation

In Microsoft Windows applications programming, OLE Automation , is an inter-process communication mechanism based on Component Object Model that was intended for use by scripting languages – originally Visual Basic – but now are used by languages run on Windows....
 protocol. It is one of the standard interfaces that can be exposed by COM
Component Object Model

Component Object Model is an interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages....
 objects. The I in IDispatch refers to interface. COM distinguishes between three interface types: custom, dispatch and dual interfaces.

IDispatch derives from IUnknown
IUnknown

In programming, the IUnknown interface is the fundamental interface in the Component Object Model . The published mandates that COM objects must minimally implement this interface....
 and extends its set of three methods
Method (computer science)

In object-oriented programming, a method is a subroutine that is exclusively associated either with a class or with an object . Like a procedure in procedural programming languages, a method usually consists of a sequence of statement to perform an action, a set of input parameter to customize those actions, and possibly an output value...
 (AddRef, Release and QueryInterface) with an additional four methods – 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 the information necessary 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
Active Server Pages

Active Server Pages , also known as Classic ASP, was Microsoft's first server-side scripting Active Scripting for dynamic web page. Initially released as an add-on to Internet Information Services via the Windows_NT_4.0#Option_Pack, it was subsequently included as a free component of Windows Server ....
 server and JavaScript
JavaScript

JavaScript is a scripting language widely used for client-side web development. It was the originating Programming language dialect of the ECMAScript standard....
 on Internet Explorer
Internet Explorer

Windows Internet Explorer , commonly abbreviated to IE, is a series of graphical user interface web browsers developed by Microsoft and included as part of the Microsoft Windows line of operating systems starting in 1995....
, where calling conventions are not known at the time IIS
Internet Information Services

Internet Information Services - formerly called Internet Information Server - is a set of Internet-based services for servers created by Microsoft for use with Microsoft Windows....
 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.

Each property and method implemented by an object that supports the IDispatch interface has what is called a Dispatch ID, which is often abbreviated DISPID. The DISPID is the primary means of identifying a property or method and must be supplied to the Invoke function for a property or method to be invoked, along with an array of Variant
Variant type

Variant is a data type in certain programming languages, particularly Visual Basic and C++ when using the Component Object Model.In Visual Basic the Variant data type is a tagged union that can be used to represent any other data type except fixed-length string type....
s containing the parameters. The GetIDsOfNames function can be used to get the appropriate DISPID from a property or method name that is in string
String (computer science)

In computer programming and some branches of mathematics, a string is an ordered sequence of symbols. These symbols are chosen from a predetermined set or alphabet....
 format.

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
Dynamic Data Exchange

Dynamic Data Exchange is a technology for communication between multiple applications under Microsoft Windows or OS/2....
 (DDE), which never became popular due to being too low-level.

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

interface IDispatch : public IUnknown ; The IDispatch interface ID is .

External links

  • , an open-source library to help using a IDispatch from C or C++.
  • , Code generator. Feature that adds IDispatch to an object. Language is C++.