Thread View: borland.public.cppbuilder.internet.web
4 messages
4 total messages
Started by Hans Galema
Wed, 01 Nov 2006 09:52
Assigning eventhandlers to TWebControl
Author: Hans Galema
Date: Wed, 01 Nov 2006 09:52
Date: Wed, 01 Nov 2006 09:52
18 lines
1557 bytes
1557 bytes
In bcb5 I could assign an eventhandler (created with the IDE) to
TCppWebBrowser like:
CppWebBrowser1->OnDocumentComplete = CppWebBrowser1DocumentComplete;
Now with Turbo C++ I have to use TWebBrowser and tried the same:
WebBrowser1->OnDocumentComplete = WebBrowser1DocumentComplete;
This is giving me following compiler error:
[C++ Error] UploadFlvFrame1.cpp(1045): E2034 Cannot convert
'void (_fastcall * (_closure )(TObject *,const IDispatch *,OleVariant &))
(TObject *,const IDispatch *,OleVariant &)'
to 'TWebBrowserDocumentComplete'
I do not understand this typedef so who can shed a light?
Hans.
Re: Assigning eventhandlers to TWebControl
Author: Eric Jensen
Date: Wed, 01 Nov 2006 18:18
Date: Wed, 01 Nov 2006 18:18
46 lines
2523 bytes
2523 bytes
I'm having a very similar problem, but with BCB 2006. I'm upgrading a project from BCB 5, and am getting the following error: [C++ Error] MyFile.cpp(38): E2034 Cannot convert 'void (_fastcall * (_closure )(TObject *,IDispatch *,Variant *))(TObject *,IDispatch *,Variant *)' to 'TCppWebBrowserDocumentComplete' with this function definition: void __fastcall navigateToOddsPageComplete(TObject *Sender, LPDISPATCH pDisp, Variant *URL); on this line: browser->OnDocumentComplete = navigateToOddsPageComplete; One other thing.. I changed all my 'TVariant's to 'Variant' during the conversion. I also noticed that the error says IDispatch * instead of LPDISPATCH, and I tried to replace it, but with no luck. (Also, the automatically generated functions by BCB use LPDISPATCH). Hopefully some can help with Hans' and my problem. Thanks, Toby "Hans Galema" <notused@notused.nl> wrote in message news:45486e95@newsgroups.borland.com... > In bcb5 I could assign an eventhandler (created with the IDE) to > TCppWebBrowser like: > > CppWebBrowser1->OnDocumentComplete = CppWebBrowser1DocumentComplete; > > Now with Turbo C++ I have to use TWebBrowser and tried the same: > > WebBrowser1->OnDocumentComplete = WebBrowser1DocumentComplete; > > This is giving me following compiler error: > [C++ Error] UploadFlvFrame1.cpp(1045): E2034 Cannot convert > 'void (_fastcall * (_closure )(TObject *,const IDispatch *,OleVariant &)) > (TObject *,const IDispatch *,OleVariant &)' > to 'TWebBrowserDocumentComplete' > > I do not understand this typedef so who can shed a light? > > Hans.
Re: Assigning eventhandlers to TWebControl
Author: Eric Jensen
Date: Thu, 02 Nov 2006 17:25
Date: Thu, 02 Nov 2006 17:25
94 lines
4071 bytes
4071 bytes
Hi Hans, I figured it out finally and it solved my problem, I assume yours is similar (but not quite the same). All I had to do was change my function definitions from: void __fastcall navigateToPageComplete(TObject *Sender, LPDISPATCH, pDisp, Variant *URL); to void __fastcall navigateToPageComplete(TObject *Sender, LPDISPATCH, pDisp, VARIANT *URL); (notice the Variant at the end is capitalized) Since you're using TWebBrowser, which has OleVariant, I'm not sure what you would have to change it to, but I found out the answer by looking in SHDocVw_OCX.h and finding the typdef for TCppWebBrowserDocumentComplete. I looked in SHDocVw.hpp, which I think is the TWebBrowser equivilant, it had: typedef void __fastcall (__closure *TWebBrowserDocumentComplete)(System::TObject* ASender, const _di_IDispatch pDisp, OleVariant &URL); so, you may want to try to change your function from (what I assume looks like this) void __fastcall WebBrowser1DocumentComplete(TObject *Sender,const IDispatch *pDisp,OleVariant &URL) to void __fastcall WebBrowser1DocumentComplete(TObject *Sender,const _di_IDispatch pDisp,OleVariant &URL) or use TCppWebBrowser (if it's available) and do the same as I did. Hope you get it going, Toby "Eric Jensen" <eric@warplabs.com> wrote in message news:4548e428@newsgroups.borland.com... > I'm having a very similar problem, but with BCB 2006. I'm upgrading a > project from BCB 5, and am getting the following error: > > [C++ Error] MyFile.cpp(38): E2034 Cannot convert 'void (_fastcall * > (_closure )(TObject *,IDispatch *,Variant *))(TObject *,IDispatch > *,Variant *)' to 'TCppWebBrowserDocumentComplete' > > with this function definition: > void __fastcall navigateToOddsPageComplete(TObject *Sender, LPDISPATCH > pDisp, Variant *URL); > > on this line: > browser->OnDocumentComplete = navigateToOddsPageComplete; > > One other thing.. I changed all my 'TVariant's to 'Variant' during the > conversion. I also noticed that the error says IDispatch * instead of > LPDISPATCH, and I tried to replace it, but with no luck. (Also, the > automatically generated functions by BCB use LPDISPATCH). > > Hopefully some can help with Hans' and my problem. > > Thanks, > > Toby > > > "Hans Galema" <notused@notused.nl> wrote in message > news:45486e95@newsgroups.borland.com... >> In bcb5 I could assign an eventhandler (created with the IDE) to >> TCppWebBrowser like: >> >> CppWebBrowser1->OnDocumentComplete = CppWebBrowser1DocumentComplete; >> >> Now with Turbo C++ I have to use TWebBrowser and tried the same: >> >> WebBrowser1->OnDocumentComplete = WebBrowser1DocumentComplete; >> >> This is giving me following compiler error: >> [C++ Error] UploadFlvFrame1.cpp(1045): E2034 Cannot convert >> 'void (_fastcall * (_closure )(TObject *,const IDispatch *,OleVariant &)) >> (TObject *,const IDispatch *,OleVariant &)' >> to 'TWebBrowserDocumentComplete' >> >> I do not understand this typedef so who can shed a light? >> >> Hans. > >
Re: Assigning eventhandlers to TWebControl
Author: Hans Galema
Date: Thu, 02 Nov 2006 20:45
Date: Thu, 02 Nov 2006 20:45
20 lines
1430 bytes
1430 bytes
Eric Jensen wrote: > so, you may want to try to change your function from (what I assume looks > like this) > > void __fastcall WebBrowser1DocumentComplete(TObject *Sender,const IDispatch > *pDisp,OleVariant &URL) > > to > > void __fastcall WebBrowser1DocumentComplete(TObject *Sender,const > _di_IDispatch pDisp,OleVariant &URL) That does it exactly. Great that you took the time to find out. Thanks. Hans.
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