Thread View: borland.public.cppbuilder.internet.web
11 messages
11 total messages
Started by Mitch McInelly
Tue, 31 Jan 2006 17:40
IHTMLSelectElement put_onchange syntax
Author: Mitch McInelly
Date: Tue, 31 Jan 2006 17:40
Date: Tue, 31 Jan 2006 17:40
79 lines
3992 bytes
3992 bytes
Can someone please show me how I can fire an onchange event for a dropdown
list after I select one of the items programatically? My current code is:
TComInterface<IHTMLDocument2> Doc;
ActiveBrowser->Document->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&Doc);
if( Doc )
{
TComInterface<IHTMLElementCollection> All;
Doc->get_all(&All);
if( All )
{
long count = 0;
All->get_length(&count);
for(long idx = 0; idx < count; ++idx)
{
TVariant item = idx;
TVariant index = 0;
TComInterface<IDispatch> Disp;
All->item(item, index, &Disp);
if( Disp )
{
WideString value;
int found;
TComInterface<IHTMLSelectElement> Input;
Disp->QueryInterface(IID_IHTMLSelectElement,(LPVOID*)&Input);
Value = "";
if( Input ) // Found a Drop down box
{ IDispatch *ppvdispOption;
IHTMLOptionElement *ppvOption;
BSTR *pszOptText;
WideString name;
Input->get_name(&name);
AnsiString Name = AnsiString(name);
if(UpperCase(Name)==UpperCase(AnsiString(Field)))
{
long i;
long length;
Input->get_length(&length);
for(i=0;i<length;i++)
{TVariant index = i;
Input->item( index, index, &ppvdispOption );
ppvdispOption->QueryInterface(
IID_IHTMLOptionElement,(void **)
&ppvOption);
ppvOption->get_text(&value);
AnsiString TValue = AnsiString(value);
Trim(TValue);
if(UpperCase(TValue)==UpperCase(Value))
{
Input->put_selectedIndex(i); // Selects
correct item from list
if(Special=='C') // Control needs to fire
onchange event...
{
TComInterface<IHTMLSelectElement> Input;
Disp->QueryInterface(IID_IHTMLSelectElement,(LPVOID*)&Input);
Input->put_onchange(index);
(etc)
This code does not appear to fire the onchange event. I know it's because
of the TVariant that I am passing to the event but I don't know what it's
looking for,
Thanks for looking
Mitch McInelly
Re: IHTMLSelectElement put_onchange syntax
Author: Remy Lebeau (TeamB)
Date: Tue, 31 Jan 2006 18:46
Date: Tue, 31 Jan 2006 18:46
100 lines
3579 bytes
3579 bytes
"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
Re: IHTMLSelectElement put_onchange syntax
Author: Mitch McInelly
Date: Tue, 31 Jan 2006 22:52
Date: Tue, 31 Jan 2006 22:52
149 lines
4806 bytes
4806 bytes
When I implement...
TVariant event;
Input->get_onchange(&event);
if( V_VT(&event) == VT_DISPATCH )
{
IDispatch *pEventDisp = V_DISPATCH(&event);
if( pEventDisp )
{
DISPPARAMS Params = {0};
TVariant Result;
and get to the last line...
> pEventDisp->Invoke(DISPID_VALUE, IID_NULL,
> LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &Params, &Result, NULL, NULL)
I get an arror that says
'An error has occured in the script on this page.
Line: 127
Char: 3
Error: 'options' is null or not an object
Code: 0
URL: blah blah blah
Do you want to continue running scripts?
Do I need to define the parameters that we are sending?
Alas I am not good enough at DOM to ' configure pEventObj as needed ...'
in your second example.
"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
>
>
Re: IHTMLSelectElement put_onchange syntax
Author: Mitch McInelly
Date: Tue, 31 Jan 2006 23:04
Date: Tue, 31 Jan 2006 23:04
123 lines
4511 bytes
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
>
>
Re: IHTMLSelectElement put_onchange syntax
Author: Remy Lebeau (TeamB)
Date: Tue, 31 Jan 2006 23:57
Date: Tue, 31 Jan 2006 23:57
14 lines
1355 bytes
1355 bytes
"Mitch McInelly" <mitch@agencysoftware.com> wrote in message news:43dfeb33$1@newsgroups.borland.com... > I get an arror that says > > 'An error has occured in the script on this page. The error suggests that the C++ code is not supplying the event handler with everything it needs, so please show the original HTML for the <select> tag and its onchange event handler. Gambit
Re: IHTMLSelectElement put_onchange syntax
Author: Remy Lebeau (TeamB)
Date: Wed, 01 Feb 2006 00:12
Date: Wed, 01 Feb 2006 00:12
305 lines
11697 bytes
11697 bytes
"Mitch McInelly" <mitch@agencysoftware.com> wrote in message
news:43dfedf0$1@newsgroups.borland.com...
> Am I missing a header or something?
No, simply an outdated PSDK. IHTMLDocument4 and IHTMLElement3 do not exist
in BCB v6 or earlier. They were created after BCB 6 was released. You will
have to define them manually (or upgrade to BDS 2006), ie:
--- MissingInterfaces.h ---
#ifndef MissingInterfacesH
#define MissingInterfacesH
#include <mshtml.h>
#ifndef __IHTMLElement3_FWD_DEFINED__
#define __IHTMLElement3_FWD_DEFINED__
typedef interface IHTMLElement3 IHTMLElement3;
#endif /* __IHTMLElement3_FWD_DEFINED__ */
#ifndef __IHTMLDocument4_FWD_DEFINED__
#define __IHTMLDocument4_FWD_DEFINED__
typedef interface IHTMLDocument4 IHTMLDocument4;
#endif /* __IHTMLDocument4_FWD_DEFINED__ */
#ifndef __IHTMLElement3_INTERFACE_DEFINED__
#define __IHTMLElement3_INTERFACE_DEFINED__
/* interface IHTMLElement3 */
/* [object][uuid][dual][oleautomation] */
EXTERN_C const IID IID_IHTMLElement3;
MIDL_INTERFACE("3050f673-98b5-11cf-bb82-00aa00bdce0b")
IHTMLElement3 : public IDispatch
{
public:
virtual /* [id] */ HRESULT STDMETHODCALLTYPE mergeAttributes(
/* [in] */ IHTMLElement *mergeThis,
/* [in][optional] */ VARIANT *pvarFlags) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_isMultiLine(
/* [out][retval] */ VARIANT_BOOL *p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_canHaveHTML(
/* [out][retval] */ VARIANT_BOOL *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_onlayoutcomplete(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_onlayoutcomplete(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_onpage(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_onpage(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [nonbrowsable][restricted][hidden][id][propput] */
HRESULT STDMETHODCALLTYPE put_inflateBlock(
/* [in] */ VARIANT_BOOL v) = 0;
virtual /* [nonbrowsable][restricted][hidden][id][propget] */
HRESULT STDMETHODCALLTYPE get_inflateBlock(
/* [out][retval] */ VARIANT_BOOL *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_onbeforedeactivate(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_onbeforedeactivate(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE setActive( void) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_contentEditable(
/* [in] */ BSTR v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_contentEditable(
/* [out][retval] */ BSTR *p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_isContentEditable(
/* [out][retval] */ VARIANT_BOOL *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_hideFocus(
/* [in] */ VARIANT_BOOL v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_hideFocus(
/* [out][retval] */ VARIANT_BOOL *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_disabled(
/* [in] */ VARIANT_BOOL v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_disabled(
/* [out][retval] */ VARIANT_BOOL *p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_isDisabled(
/* [out][retval] */ VARIANT_BOOL *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_onmove(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_onmove(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_oncontrolselect(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_oncontrolselect(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE fireEvent(
/* [in] */ BSTR bstrEventName,
/* [in][optional] */ VARIANT *pvarEventObject,
/* [out][retval] */ VARIANT_BOOL *pfCancelled) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_onresizestart(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_onresizestart(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_onresizeend(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_onresizeend(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_onmovestart(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_onmovestart(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_onmoveend(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_onmoveend(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_onmouseenter(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_onmouseenter(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_onmouseleave(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_onmouseleave(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_onactivate(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_onactivate(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_ondeactivate(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_ondeactivate(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE dragDrop(
/* [out][retval] */ VARIANT_BOOL *pfRet) = 0;
virtual /* [nonbrowsable][restricted][hidden][id][propget] */
HRESULT STDMETHODCALLTYPE get_glyphMode(
/* [out][retval] */ LONG *p) = 0;
};
#endif /* __IHTMLElement3_INTERFACE_DEFINED__ */
#ifndef __IHTMLDocument4_INTERFACE_DEFINED__
#define __IHTMLDocument4_INTERFACE_DEFINED__
/* interface IHTMLDocument4 */
/* [object][uuid][dual][oleautomation] */
EXTERN_C const IID IID_IHTMLDocument4;
MIDL_INTERFACE("3050f69a-98b5-11cf-bb82-00aa00bdce0b")
IHTMLDocument4 : public IDispatch
{
public:
virtual /* [id] */ HRESULT STDMETHODCALLTYPE focus( void) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE hasFocus(
/* [out][retval] */ VARIANT_BOOL *pfFocus) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_onselectionchange(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_onselectionchange(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_namespaces(
/* [out][retval] */ IDispatch **p) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE createDocumentFromUrl(
/* [in] */ BSTR bstrUrl,
/* [in] */ BSTR bstrOptions,
/* [out][retval] */ IHTMLDocument2 **newDoc) = 0;
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_media(
/* [in] */ BSTR v) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_media(
/* [out][retval] */ BSTR *p) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE createEventObject(
/* [in][optional] */ VARIANT *pvarEventObject,
/* [out][retval] */ IHTMLEventObj **ppEventObj) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE fireEvent(
/* [in] */ BSTR bstrEventName,
/* [in][optional] */ VARIANT *pvarEventObject,
/* [out][retval] */ VARIANT_BOOL *pfCancelled) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE createRenderStyle(
/* [in] */ BSTR v,
/* [out][retval] */ IHTMLRenderStyle **ppIHTMLRenderStyle) = 0;
virtual /* [bindable][displaybind][id][propput] */ HRESULT
STDMETHODCALLTYPE put_oncontrolselect(
/* [in] */ VARIANT v) = 0;
virtual /* [bindable][displaybind][id][propget] */ HRESULT
STDMETHODCALLTYPE get_oncontrolselect(
/* [out][retval] */ VARIANT *p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_URLUnencoded(
/* [out][retval] */ BSTR *p) = 0;
};
#endif /* __IHTMLDocument4_INTERFACE_DEFINED__ */
#endif /* MissingInterfacesH */
--- MissingInterfaces.cpp ---
#include "MissingInterfaces.h"
const IID IID_IHTMLElement3 = {0x3050f673, 0x98b5, 0x11cf, {0xbb, 0x82,
0x00, 0xaa, 0x00, 0xbd, 0xce, 0x0b}};
const IID IID_IHTMLDocument4 = {0x3050f69a, 0x98b5, 0x11cf, {0xbb, 0x82,
0x00, 0xaa, 0x00, 0xbd, 0xce, 0x0b}};
Gambit
Re: IHTMLSelectElement put_onchange syntax
Author: Mitch McInelly
Date: Wed, 01 Feb 2006 00:23
Date: Wed, 01 Feb 2006 00:23
102 lines
7602 bytes
7602 bytes
<SELECT NAME="vehicleMake" SIZE="1" class="drop_down_dynamic" style="position:absolute; width:80; z-index:3;" onclick="_dropdownListClick(this)" onblur="_dropdownListBlur(this)" onMouseover="_dropdownListMouseFocusOver(this, 80)" onfocus="findSelected(this);_dropdownListMouseFocusOver(this, 80)" onMouseout="" onChange="javascript: setPageDataChangeIndicator(); changeMake(document.all['vehicleYear'].value,this,'vehicleModel') " > <OPTION VALUE=""></OPTION> <OPTION VALUE="3">ACURA </OPTION> <OPTION VALUE="5">ALFA ROMEO </OPTION> <OPTION VALUE="293">AM GENERAL </OPTION> <OPTION VALUE="312">AMER MOTORS </OPTION> <OPTION VALUE="14">ASTON MARTIN </OPTION> <OPTION VALUE="15">AUDI </OPTION> <OPTION VALUE="17">AUSTINHEALEY </OPTION> <OPTION VALUE="18">AVANTI </OPTION> <OPTION VALUE="19">BENTLEY </OPTION> <OPTION VALUE="21">BMW </OPTION> <OPTION VALUE="294">BRICKLIN </OPTION> <OPTION VALUE="24">BUICK </OPTION> <OPTION VALUE="26">CADILLAC </OPTION> <OPTION VALUE="347">CART-RITE </OPTION> <OPTION VALUE="45">CHEVROLET </OPTION> <OPTION VALUE="46">CHRYSLER </OPTION> <OPTION VALUE="49">CITROEN </OPTION> <OPTION VALUE="337">DAEWOO </OPTION> <OPTION VALUE="71">DE TOMASO </OPTION> <OPTION VALUE="76">DODGE </OPTION> <OPTION VALUE="94">FERRARI </OPTION> <OPTION VALUE="95">FIAT </OPTION> <OPTION VALUE="102">FORD </OPTION> <OPTION VALUE="313">GM </OPTION> <OPTION VALUE="109">GMC </OPTION> <OPTION VALUE="118">HONDA </OPTION> <OPTION VALUE="339">HUMMER </OPTION> <OPTION VALUE="120">HYUNDAI </OPTION> <OPTION VALUE="123">IMPERIAL </OPTION> <OPTION VALUE="125">INFINITI </OPTION> <OPTION VALUE="126">INTERNATIONAL </OPTION> <OPTION VALUE="127">ISUZU </OPTION> <OPTION VALUE="129">JAGUAR </OPTION> <OPTION VALUE="130">JEEP </OPTION> <OPTION VALUE="131">JENSEN </OPTION> <OPTION VALUE="304">KIA </OPTION> <OPTION VALUE="140">LAMBORGHINI </OPTION> <OPTION VALUE="311">LAND ROVER </OPTION> <OPTION VALUE="151">LEXUS </OPTION> <OPTION VALUE="154">LINCOLN </OPTION> <OPTION VALUE="155">LOTUS </OPTION> <OPTION VALUE="167">MASERATI </OPTION> <OPTION VALUE="341">MAYBACH </OPTION> <OPTION VALUE="169">MAZDA </OPTION> <OPTION VALUE="172">MERCEDES-BENZ </OPTION> <OPTION VALUE="173">MERCURY </OPTION> <OPTION VALUE="175">MG </OPTION> <OPTION VALUE="338">MINI </OPTION> <OPTION VALUE="179">MITSUBISHI </OPTION> <OPTION VALUE="297">MORGAN </OPTION> <OPTION VALUE="191">NISSAN/DATSUN </OPTION> <OPTION VALUE="195">OLDSMOBILE </OPTION> <OPTION SELECTED VALUE="0">OTHER </OPTION> <OPTION VALUE="199">OTHER AMERICAN MAKE </OPTION> <OPTION VALUE="200">OTHER BRITISH MAKE </OPTION> <OPTION VALUE="201">OTHER FOREIGN MAKE </OPTION> <OPTION VALUE="203">PANOZ </OPTION> <OPTION VALUE="204">PEUGEOT </OPTION> <OPTION VALUE="210">PLYMOUTH </OPTION> <OPTION VALUE="211">PONTIAC </OPTION> <OPTION VALUE="213">PORSCHE </OPTION> <OPTION VALUE="224">RENAULT </OPTION> <OPTION VALUE="226">ROLLS ROYCE </OPTION> <OPTION VALUE="227">SAAB </OPTION> <OPTION VALUE="230">SATURN </OPTION> <OPTION VALUE="231">SCION </OPTION> <OPTION VALUE="247">SUBARU </OPTION> <OPTION VALUE="249">SUZUKI </OPTION> <OPTION VALUE="263">TOYOTA </OPTION> <OPTION VALUE="265">TRIUMPH </OPTION> <OPTION VALUE="274">VOLKSWAGEN </OPTION> <OPTION VALUE="276">VOLVO </OPTION> </SELECT> "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:43dff8bc@newsgroups.borland.com... > > "Mitch McInelly" <mitch@agencysoftware.com> wrote in message > news:43dfeb33$1@newsgroups.borland.com... > >> I get an arror that says >> >> 'An error has occured in the script on this page. > > The error suggests that the C++ code is not supplying the event handler > with > everything it needs, so please show the original HTML for the <select> tag > and its onchange event handler. > > > Gambit > >
Re: IHTMLSelectElement put_onchange syntax
Author: Mitch McInelly
Date: Wed, 01 Feb 2006 00:25
Date: Wed, 01 Feb 2006 00:25
316 lines
12328 bytes
12328 bytes
Wow! Did you just type all of that in?
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:43dffc47$1@newsgroups.borland.com...
>
> "Mitch McInelly" <mitch@agencysoftware.com> wrote in message
> news:43dfedf0$1@newsgroups.borland.com...
>
>> Am I missing a header or something?
>
> No, simply an outdated PSDK. IHTMLDocument4 and IHTMLElement3 do not
> exist
> in BCB v6 or earlier. They were created after BCB 6 was released. You
> will
> have to define them manually (or upgrade to BDS 2006), ie:
>
> --- MissingInterfaces.h ---
>
> #ifndef MissingInterfacesH
> #define MissingInterfacesH
>
> #include <mshtml.h>
>
> #ifndef __IHTMLElement3_FWD_DEFINED__
> #define __IHTMLElement3_FWD_DEFINED__
> typedef interface IHTMLElement3 IHTMLElement3;
> #endif /* __IHTMLElement3_FWD_DEFINED__ */
>
> #ifndef __IHTMLDocument4_FWD_DEFINED__
> #define __IHTMLDocument4_FWD_DEFINED__
> typedef interface IHTMLDocument4 IHTMLDocument4;
> #endif /* __IHTMLDocument4_FWD_DEFINED__ */
>
>
> #ifndef __IHTMLElement3_INTERFACE_DEFINED__
> #define __IHTMLElement3_INTERFACE_DEFINED__
>
> /* interface IHTMLElement3 */
> /* [object][uuid][dual][oleautomation] */
>
>
> EXTERN_C const IID IID_IHTMLElement3;
>
>
> MIDL_INTERFACE("3050f673-98b5-11cf-bb82-00aa00bdce0b")
> IHTMLElement3 : public IDispatch
> {
> public:
> virtual /* [id] */ HRESULT STDMETHODCALLTYPE mergeAttributes(
> /* [in] */ IHTMLElement *mergeThis,
> /* [in][optional] */ VARIANT *pvarFlags) = 0;
>
> virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
> get_isMultiLine(
> /* [out][retval] */ VARIANT_BOOL *p) = 0;
>
> virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
> get_canHaveHTML(
> /* [out][retval] */ VARIANT_BOOL *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_onlayoutcomplete(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_onlayoutcomplete(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_onpage(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_onpage(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [nonbrowsable][restricted][hidden][id][propput] */
> HRESULT STDMETHODCALLTYPE put_inflateBlock(
> /* [in] */ VARIANT_BOOL v) = 0;
>
> virtual /* [nonbrowsable][restricted][hidden][id][propget] */
> HRESULT STDMETHODCALLTYPE get_inflateBlock(
> /* [out][retval] */ VARIANT_BOOL *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_onbeforedeactivate(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_onbeforedeactivate(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [id] */ HRESULT STDMETHODCALLTYPE setActive( void) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_contentEditable(
> /* [in] */ BSTR v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_contentEditable(
> /* [out][retval] */ BSTR *p) = 0;
>
> virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
> get_isContentEditable(
> /* [out][retval] */ VARIANT_BOOL *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_hideFocus(
> /* [in] */ VARIANT_BOOL v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_hideFocus(
> /* [out][retval] */ VARIANT_BOOL *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_disabled(
> /* [in] */ VARIANT_BOOL v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_disabled(
> /* [out][retval] */ VARIANT_BOOL *p) = 0;
>
> virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
> get_isDisabled(
> /* [out][retval] */ VARIANT_BOOL *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_onmove(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_onmove(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_oncontrolselect(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_oncontrolselect(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [id] */ HRESULT STDMETHODCALLTYPE fireEvent(
> /* [in] */ BSTR bstrEventName,
> /* [in][optional] */ VARIANT *pvarEventObject,
> /* [out][retval] */ VARIANT_BOOL *pfCancelled) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_onresizestart(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_onresizestart(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_onresizeend(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_onresizeend(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_onmovestart(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_onmovestart(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_onmoveend(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_onmoveend(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_onmouseenter(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_onmouseenter(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_onmouseleave(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_onmouseleave(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_onactivate(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_onactivate(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_ondeactivate(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_ondeactivate(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [id] */ HRESULT STDMETHODCALLTYPE dragDrop(
> /* [out][retval] */ VARIANT_BOOL *pfRet) = 0;
>
> virtual /* [nonbrowsable][restricted][hidden][id][propget] */
> HRESULT STDMETHODCALLTYPE get_glyphMode(
> /* [out][retval] */ LONG *p) = 0;
>
> };
>
>
> #endif /* __IHTMLElement3_INTERFACE_DEFINED__ */
>
>
> #ifndef __IHTMLDocument4_INTERFACE_DEFINED__
> #define __IHTMLDocument4_INTERFACE_DEFINED__
>
> /* interface IHTMLDocument4 */
> /* [object][uuid][dual][oleautomation] */
>
>
> EXTERN_C const IID IID_IHTMLDocument4;
>
>
> MIDL_INTERFACE("3050f69a-98b5-11cf-bb82-00aa00bdce0b")
> IHTMLDocument4 : public IDispatch
> {
> public:
> virtual /* [id] */ HRESULT STDMETHODCALLTYPE focus( void) = 0;
>
> virtual /* [id] */ HRESULT STDMETHODCALLTYPE hasFocus(
> /* [out][retval] */ VARIANT_BOOL *pfFocus) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_onselectionchange(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_onselectionchange(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
> get_namespaces(
> /* [out][retval] */ IDispatch **p) = 0;
>
> virtual /* [id] */ HRESULT STDMETHODCALLTYPE createDocumentFromUrl(
> /* [in] */ BSTR bstrUrl,
> /* [in] */ BSTR bstrOptions,
> /* [out][retval] */ IHTMLDocument2 **newDoc) = 0;
>
> virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_media(
> /* [in] */ BSTR v) = 0;
>
> virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_media(
> /* [out][retval] */ BSTR *p) = 0;
>
> virtual /* [id] */ HRESULT STDMETHODCALLTYPE createEventObject(
> /* [in][optional] */ VARIANT *pvarEventObject,
> /* [out][retval] */ IHTMLEventObj **ppEventObj) = 0;
>
> virtual /* [id] */ HRESULT STDMETHODCALLTYPE fireEvent(
> /* [in] */ BSTR bstrEventName,
> /* [in][optional] */ VARIANT *pvarEventObject,
> /* [out][retval] */ VARIANT_BOOL *pfCancelled) = 0;
>
> virtual /* [id] */ HRESULT STDMETHODCALLTYPE createRenderStyle(
> /* [in] */ BSTR v,
> /* [out][retval] */ IHTMLRenderStyle **ppIHTMLRenderStyle) = 0;
>
> virtual /* [bindable][displaybind][id][propput] */ HRESULT
> STDMETHODCALLTYPE put_oncontrolselect(
> /* [in] */ VARIANT v) = 0;
>
> virtual /* [bindable][displaybind][id][propget] */ HRESULT
> STDMETHODCALLTYPE get_oncontrolselect(
> /* [out][retval] */ VARIANT *p) = 0;
>
> virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
> get_URLUnencoded(
> /* [out][retval] */ BSTR *p) = 0;
>
> };
>
>
> #endif /* __IHTMLDocument4_INTERFACE_DEFINED__ */
>
> #endif /* MissingInterfacesH */
>
>
>
> --- MissingInterfaces.cpp ---
>
> #include "MissingInterfaces.h"
>
> const IID IID_IHTMLElement3 = {0x3050f673, 0x98b5, 0x11cf, {0xbb, 0x82,
> 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x0b}};
> const IID IID_IHTMLDocument4 = {0x3050f69a, 0x98b5, 0x11cf, {0xbb, 0x82,
> 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x0b}};
>
>
> Gambit
>
>
Re: IHTMLSelectElement put_onchange syntax
Author: Remy Lebeau (TeamB)
Date: Wed, 01 Feb 2006 01:33
Date: Wed, 01 Feb 2006 01:33
10 lines
1331 bytes
1331 bytes
"Mitch McInelly" <mitch@agencysoftware.com> wrote in message news:43e000ee$1@newsgroups.borland.com... > Wow! Did you just type all of that in? I copied most of it from BDS 2006's copy of mshtml.h. Gambit
Re: IHTMLSelectElement put_onchange syntax
Author: Remy Lebeau (TeamB)
Date: Wed, 01 Feb 2006 02:04
Date: Wed, 01 Feb 2006 02:04
21 lines
1732 bytes
1732 bytes
"Mitch McInelly" <mitch@agencysoftware.com> wrote in message
news:43e00082$1@newsgroups.borland.com...
> onChange="javascript: setPageDataChangeIndicator();
> changeMake(document.all['vehicleYear'].value,this,'vehicleModel') "
The onChange event is accessing the 'this' pointer. Try passing the
IHTMLSelectElement as a parameter when calling Invoke(), ie:
if( pEventDisp )
{
TVariant Result, Arg = (IDispatch*) (IHTMLSelectElement*) Input;
DISPID Id = DISPID_THIS;
DISPPARAMS Params = {&Arg, &Id, 1, 1};
pEventDisp->Invoke(DISPID_VALUE, IID_NULL, LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD, &Params, &Result, NULL, NULL);
}
Gambit
Re: IHTMLSelectElement put_onchange syntax
Author: Mitch McInelly
Date: Wed, 01 Feb 2006 17:33
Date: Wed, 01 Feb 2006 17:33
31 lines
2222 bytes
2222 bytes
That did the trick Remy! Thanks again.
Mitch
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:43e016aa$1@newsgroups.borland.com...
>
> "Mitch McInelly" <mitch@agencysoftware.com> wrote in message
> news:43e00082$1@newsgroups.borland.com...
>
>> onChange="javascript: setPageDataChangeIndicator();
>> changeMake(document.all['vehicleYear'].value,this,'vehicleModel') "
>
> The onChange event is accessing the 'this' pointer. Try passing the
> IHTMLSelectElement as a parameter when calling Invoke(), ie:
>
> if( pEventDisp )
> {
> TVariant Result, Arg = (IDispatch*) (IHTMLSelectElement*) Input;
> DISPID Id = DISPID_THIS;
> DISPPARAMS Params = {&Arg, &Id, 1, 1};
> pEventDisp->Invoke(DISPID_VALUE, IID_NULL, LOCALE_SYSTEM_DEFAULT,
> DISPATCH_METHOD, &Params, &Result, NULL, NULL);
> }
>
>
> Gambit
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads