🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Assigning eventhandlers to TWebControl

#731
From: Eric Jensen
Date: Thu, 02 Nov 2006 17:25
94 lines
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.
>
> 
Technical Details
Message-ID: <454a293d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45486e95@newsgroups.borland.com> <4548e428@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,8607198c852a630
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Eric Jensen" <eric@warplabs.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <45486e95@newsgroups.borland.com> <4548e428@newsgroups.borland.com>
Subject: Re: Assigning eventhandlers to TWebControl
Date: Thu, 2 Nov 2006 10:25:12 -0700
Lines: 96
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
NNTP-Posting-Host: 68.145.110.49
Message-ID: <454a293d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1162488125 68.145.110.49 (2 Nov 2006 09:22:05 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail