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 

Derive TCppWebBrowser

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
Nico Reinacher
Guest





PostPosted: Sat Nov 29, 2003 3:46 pm    Post subject: Derive TCppWebBrowser Reply with quote



Hello!

I have problems to create a class derived from TCppWebBrowser (see code
example).
If the function "Navigate" executed in the "FormShow"-function, the
C++Builder 5 throw
an exception "EAccessViolation". Why?? How can I solve this problem?

Header file:
-----------
//--------------------------------------------------------------------------
-

#ifndef MainH
#define MainH
//--------------------------------------------------------------------------
-
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <shdocvw_ocx.h>
//--------------------------------------------------------------------------
-

class TIBrowser;

class TMainForm : public TForm
{
__published: // Von der IDE verwaltete Komponenten
void __fastcall FormShow(TObject *Sender);
private: // Anwender-Deklarationen
public: // Anwender-Deklarationen
TIBrowser *Browser;
__fastcall TMainForm(TComponent* Owner);
};
//--------------------------------------------------------------------------
-
extern PACKAGE TMainForm *MainForm;
//--------------------------------------------------------------------------
-

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

#endif
cpp-file:
--------
//--------------------------------------------------------------------------
-

#include <vcl.h>
#pragma hdrstop

#include "Main.h"
//--------------------------------------------------------------------------
-
#pragma package(smart_init)
#pragma resource "*.dfm"
TMainForm *MainForm;
//--------------------------------------------------------------------------
-
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner)
{
Browser = new TIBrowser(this); Browser->ParentWindow = Handle;
Browser->TOleControl::Parent = MainForm; Browser->Align = alClient;}
//--------------------------------------------------------------------------
-

__fastcall TIBrowser::TIBrowser(TComponent* Owner)
: TCppWebBrowser(Owner)
{
//TODO: Hier Ihren Quelltext einfügen
}
//--------------------------------------------------------------------------
-

void __fastcall TMainForm::FormShow(TObject *Sender)
{
Browser->Navigate( WideString("about:blank") );
}
//--------------------------------------------------------------------------
-

Thanks
Nico


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Sun Nov 30, 2003 4:54 am    Post subject: Re: Derive TCppWebBrowser Reply with quote




"Nico Reinacher" <nico.reinacher (AT) t-online (DOT) de> wrote


Quote:
If the function "Navigate" executed in the "FormShow"-function,
the C++Builder 5 throw an exception "EAccessViolation". Why??

An AV occurs when you try to access invalid memory. The form's OnShow event
can be triggered before the form is finished being initialized, so you are
probably trying to access the browser before it has even been instantiated
yet. Do you, by change, have the OldCreateOrder property set to true?


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) 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.