🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #801

Re: IHTMLSelectElement put_onchange syntax

#801
From: Mitch McInelly
Date: Tue, 31 Jan 2006 23:04
123 lines
4511 bytes
Also, even if I do try to compile using the second example:

TComInterface<IHTMLDocument4> Doc4 = Doc;

// I get 'Undefined Symbol IHTMLDocument4'
//and then 'Cannot generate template specailization from 
TComInterface(T,piid)' on this line

 TComInterface<IHTMLElement3> Element = Input;

// and then 'Undefined symbol 'IHTMLElement3' here

Am I missing a header or something?

Mitch


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:43dfb00a$1@newsgroups.borland.com...
>
> "Mitch McInelly" <mitch@agencysoftware.com> wrote in message
> news:43dfa1e5$1@newsgroups.borland.com...
>
>> IDispatch *ppvdispOption;
>> IHTMLOptionElement *ppvOption;
>
> You should wrap those in TComInterface so that you do not leak them.
>
>> BSTR *pszOptText;
>
> Use a WideString instead so that you do not leak it.
>
>> if(UpperCase(Name)==UpperCase(AnsiString(Field)))
>
> Use AnsiSameText() instead:
>
>    if( AnsiSameText(name, Field) )
>
> Or, if you are using BCB 6+, then use WideSameText():
>
>    if( WideSameText(name, Field) )
>
>> Trim(TValue);
>
> That has no effect.  Trim() does not alter the string that is passed to 
> it.
> It returns a new AnsiString instead:
>
>    AnsiString TValue = value;
>    TValue = Trim(TValue);
>
> Or:
>
>    AnsiString TValue = AnsiString(value).Trim();
>
> Alternatively, if you are using BCB v6+, then Trim() has an overloaded
> version for WideString:
>
>    WideString TValue = Trim(value);
>
>> if(UpperCase(TValue)==UpperCase(Value))
>
> Again, use AnsiSameText() (or WideSameText()):
>
>    if( AnsiSameText(TValue, Value) )
>
>> TComInterface<IHTMLSelectElement> Input;
>> Disp->QueryInterface(IID_IHTMLSelectElement,(LPVOID*)&Input);
>> Input->put_onchange(index);
>
> That will not work.  In order to trigger the event, you have to RETRIEVE 
> the
> event handler and then call it directly, but you are trying to ASSIGN the
> handler instead (and not properly at that).  Use this instead:
>
>    TVariant event;
>    Input->get_onchange(&event);
>    if( V_VT(&event) == VT_DISPATCH )
>    {
>        IDispatch *pEventDisp = V_DISPATCH(&event);
>        if( pEventDisp )
>        {
>            DISPPARAMS Params = {0};
>            TVariant Result;
>            pEventDisp->Invoke(DISPID_VALUE, IID_NULL,
> LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &Params, &Result, NULL, NULL)
>        }
>    }
>
> Alternatively, use the IHTMLElement3::fireEvent() method instead:
>
>    TComInterface<IHTMLDocument4> Doc4 = Doc;
>    TComInterface<IHTMLElement3> Element = Input;
>
>    if( (Doc4) && (Element) )
>    {
>        IHTMLEventObj *pEventObj = NULL;
>        Doc4->createEventObject(NULL, &pEventObj);
>        if( pEventObj )
>        {
>            TVariant Event;
>            VARIANT_BOOL Canceled = VARIANT_FALSE;
>
>            V_VT(&Event) = VT_DISPATCH;
>            V_DISPATCH(&Event) = pEventObj;
>            // configure pEventObj as needed ...
>
>            Element->fireEvent(WideString("onchange"), &Event, &Canceled);
>        }
>    }
>    else
>    {
>        // use the code further above ...
>    }
>
>> This code does not appear to fire the onchange event.
>
> Of course not.  You are not even calling the event handler at all.
>
>
> Gambit
>
> 
Technical Details
Message-ID: <43dfedf0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!195.92.193.196.MISMATCH!nntp.theplanet.net!inewsm1.nntp.theplanet.net!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43dfa1e5$1@newsgroups.borland.com> <43dfb00a$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,4307e96a2fc07463
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Mitch McInelly" <mitch@agencysoftware.com>
From: "Mitch McInelly" <mitch@agencysoftware.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <43dfa1e5$1@newsgroups.borland.com> <43dfb00a$1@newsgroups.borland.com>
Subject: Re: IHTMLSelectElement put_onchange syntax
Date: Tue, 31 Jan 2006 15:04:26 -0800
Lines: 125
Organization: Agency Software, Inc.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 207.88.115.45
Message-ID: <43dfedf0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1138748912 207.88.115.45 (31 Jan 2006 15:08:32 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!195.92.193.196.MISMATCH!nntp.theplanet.net!inewsm1.nntp.theplanet.net!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail