Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 774741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:10:48+00:00 2026-05-14T19:10:48+00:00

In Delphi you can pass class references around to compare the types of objects,

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T19:10:49+00:00Added an answer on May 14, 2026 at 7:10 pm

    The SysUtils unit comes with at least five overloads of Supports, and they all accept a TGUID value for their second parameters.

    You can indeed pass interface types as parameters, but they’re really just GUIDs. That is, when a function expects a TGUID argument, you can pass it the interface type identifier, such as IMBNode or IUnknown. For that to work, though, the interface type needs to include a GUID in its declaration, like this:

    type
      IMBNode = interface
        ['{GUID-goes-here}']
        // methods and properties
      end;
    

    When the first parameter to Supports is an interface reference, the function calls its QueryInterface method. If it returns S_OK, then Supports return true; otherwise, it returns false. When the first parameter is an object reference, then it first calls the object’s GetInterface method to get its IUnknown interface, and calls Supports on that like before. If it doesn’t work that way, then it falls back to asking for the requested interface directly from GetInterface. If you’ve implemented QueryInterface correctly on your object, or if you’ve used the default implementation from TInterfacedObject, then everything should work fine.

    If Supports never returns true for you, then you should revisit some assumptions. Are you sure your node really supports the interface you’re requesting? Go make sure the class declaration includes that interface. Make sure QueryInterface is implemented properly. And make sure SomeNode actually refers to the node you’re expecting it to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why can't Delphi variants hold objects? More importantly, what's the reason behind this limitation?
I have a delphi (Win32) web application that can run either as a CGI
Were can I find some good Podcasts that talk about program with Delphi &
In Delphi, you can use compiler directives to disable specific warnings, such as {$WARN
In the Delphi IDE, you can hold control and click on a method to
Does that mean that I can't share a Form between delphi 2007 and 2009?
Can anyone tell me why the second cast fails to compile in Delphi 7?
Do you know where can I find a Delphi code sample for fingerprint recognition
I'm using Delphi 2007. How can I put a GIF/PNG image on a BitBtn
I'm may be missing something but I can't find the Delphi 2007 WSDL Importer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.