πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #742

Re: Supports function

#742
From: Remy Lebeau (TeamB)
Date: Tue, 22 Jan 2008 19:30
42 lines
2019 bytes
"Carlos" <a@a.com> wrote in message 
news:4794f632$1@newsgroups.borland.com...

> I am trying to use Supports function of SysUtils. But I donοΏ½t know how

You are passing the interface types the wrong way.  Do not use the '_di_...' 
typedefs.  You need to use the interface IIDs instead, ie:

    TWinControl *pAC = Screen->ActiveControl;
    if( pAC )
    {
        TcxCustomEdit *pCE = NULL;
        if( Supports(pAC, IID_IcxInnerEditHelper) || Supports(pAC, 
IID_IcxContainerInnerControl) )
            pCE = (TcxCustomEdit*) pAC->Owner;
        //...
    }

Or:

    TWinControl *pAC = Screen->ActiveControl;
    if( pAC )
    {
        TcxCustomEdit *pCE = NULL;
        if( Supports(pAC, __uuidof(IcxInnerEditHelper)) || Supports(pAC, 
__uuidof(IcxContainerInnerControl)) )
            pCE = (TcxCustomEdit*) pAC->Owner;
        //...
    }

Or, you could simply use dynamic_cast and ignore Supports() altogether:

    TWinControl * pAC = Screen->ActiveControl;
    if( pAC )
    {
        TcxCustomEdit *pCE = dynamic_cast<TcxCustomEdit*>(pAC->Owner);
        //...
    }


Gambit 
Technical Details
Message-ID: <47964411$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4794f632$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,daf5f44246da1da
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4794f632$1@newsgroups.borland.com>
Subject: Re: Supports function
Date: Tue, 22 Jan 2008 11:30:14 -0800
Lines: 44
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 207.178.157.90
Message-ID: <47964411$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1201030161 207.178.157.90 (22 Jan 2008 11:29:21 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail