BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Deriving a control from TCppWebBrowser

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (ActiveX)
View previous topic :: View next topic  
Author Message
Brad
Guest





PostPosted: Fri Jul 07, 2006 8:10 am    Post subject: Deriving a control from TCppWebBrowser Reply with quote



Hi!

I've googled my fingers to the bone looking for a solution to this problem, but have had no luck whatsoever. Here's hoping that someone can help me:

I'm trying to derive a control from TCppWebBrowser.
In Main.h I have:

class TCppWebBrowserEx : public TCppWebBrowser
{
public:
__fastcall TCppWebBrowserEx(TComponent* Owner) : TCppWebBrowser(Owner) {};
};

And then in Main.cpp I have:

TCppWebBrowserEx *pBrowser = new TCppWebBrowserEx(this);
pBrowser->TOleControl::Parent = PageControl->ActivePage;
pBrowser->Align = alClient;
pBrowser->Navigate(WideString("about:blank"));

The last Navigate command is causing an access violation. If I change the first line to "TCppWebBrowser *pBrowser = new TCppWebBrowser(this)", everything works as expected.

Is there anything I'm doing wrong? Do I need to do something else to get this working? Or is it that you just can't subclass TCppWebBrowser at all in this way like you can with other controls, because it's a wrapper for an ActiveX control?

Any help will be IMMENSELY appreciated.

Thanks in advance.

Brad.
Back to top
Mark Guerrieri
Guest





PostPosted: Fri Jul 07, 2006 6:47 pm    Post subject: Re: Deriving a control from TCppWebBrowser Reply with quote



Quote:
Is there anything I'm doing wrong? Do I need to do something else to get
this working? Or is it that you just can't subclass TCppWebBrowser at all
in this way like you can with other controls, because it's a wrapper for
an ActiveX control?


Try setting Visible to true prior to calling Navigate for the first time. I
seem to remeber similat problems in BCB6 when calling Navigate on a new
instance of a derived browser. For me, showing the form first solved the
problem, but this may be unrelated.

Mark
Back to top
Brad Harding
Guest





PostPosted: Sat Jul 08, 2006 6:30 am    Post subject: Re: Deriving a control from TCppWebBrowser Reply with quote



Thanks for your assistance, Mark, but unfortunately it doesn't solve the problem. Putting "pBrowser->Visible = true" before the Navigate command doesn't seem to make any difference, and the access violation is still raised...

Brad.

"Mark Guerrieri" <mguerrieri (AT) no_spam_verizon (DOT) net> wrote:

Quote:
Try setting Visible to true prior to calling Navigate for the first time. I
seem to remeber similat problems in BCB6 when calling Navigate on a new
instance of a derived browser. For me, showing the form first solved the
problem, but this may be unrelated.

Mark
Back to top
Mark Guerrieri
Guest





PostPosted: Wed Jul 12, 2006 7:15 pm    Post subject: Re: Deriving a control from TCppWebBrowser Reply with quote

Make sure the entire form containing the browser control is visible...

"Brad Harding" <bradharding (AT) gmail (DOT) com> wrote in message
news:44af0abb$1 (AT) newsgroups (DOT) borland.com...
Quote:

Thanks for your assistance, Mark, but unfortunately it doesn't solve the
problem. Putting "pBrowser->Visible = true" before the Navigate command
doesn't seem to make any difference, and the access violation is still
raised...

Brad.

"Mark Guerrieri" <mguerrieri (AT) no_spam_verizon (DOT) net> wrote:

Try setting Visible to true prior to calling Navigate for the first time.
I
seem to remeber similat problems in BCB6 when calling Navigate on a new
instance of a derived browser. For me, showing the form first solved the
problem, but this may be unrelated.

Mark
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (ActiveX) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.