Name
IDispatch Interface
Syntax
type
IDispatch = interface(IUnknown)
['{00020400-0000-0000-C000-000000000046}']
function GetTypeInfoCount(out Count: Integer): HResult; stdcall;
function GetTypeInfo(Index, LocaleID: Integer; out TypeInfo):
HResult; stdcall;
function GetIDsOfNames(const IID: TGUID; Names: Pointer;
NameCount, LocaleID: Integer; DispIDs: Pointer):
HResult; stdcall;
function Invoke(DispID: Integer; const IID: TGUID;
LocaleID: Integer; Flags: Word; var Params;
VarResult, ExcepInfo, ArgErr: Pointer): HResult; stdcall;
end;Description
IDispatch is a standard ActiveX interface that
lets you call a COM method without knowing the method’s name,
arguments, or return type at compile
time.
Tips and Tricks
When you use a COM object that implements the
IDispatchinterface, Delphi automatically takes care of all the details involved in calling a method dynamically. You can store the object reference in aVariantvariable or use adispinterfacetype.To write a COM server that implements the
IDispatchinterface, simply derive your class fromTAutoObject(in theComObjunit) or one of its descendants. If you are using Delphi’s type library editor, simply check the box for the Dual flag, and let Delphi handle the details for you.See the Windows Platform SDK documentation to learn more about the
IDispatchinterface.
See Also
| Dispinterface Keyword, Interface Keyword, IUnknown Interface, VarDispProc Variable, Variant Type |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access