How to pass interface type/GUID reference to an automation method in Delphi

Posted by Alan Clark on Stack Overflow See other posts from Stack Overflow or by Alan Clark
Published on 2010-05-10T10:15:19Z Indexed on 2010/05/10 14:34 UTC
Read the original article Hit count: 260

Filed under:
|
|

In Delphi you can pass class references around to compare the types of objects, and to instantiate them. Can you do the same with interface references being passed to a COM automation server?

For example, you can define a method taking a GUID parameter using the type library editor:

function ChildNodesOfType(NodeType: TGUID): IMBNode; safecall;

In this function I would like to return automation types that support the interface specified by NodeType, e.g.

if Supports(SomeNode, NodeType) then
      result := SomeNode;

But the Supports call always fails, I tried passing in the Guids defined in the type library but none of the different types (Ixxx, Class_xxxx, IId_Ixxxx) seem to work.

© Stack Overflow or respective owner

Related posts about delphi

Related posts about automation