TCppWebBrowser component

c++ builder

    Sponsored Links


  • 1. Just cheer up.
    Just to cheer you up guys. We had a great time with BCB for years. I am fighting with some VC++ 6. STL and is that pain in the neck? The debug build produces countless warnings for truncations as soon as you include the STL map :-( . It is almost impossible to find an compile error among those. Yes BCB has its own issues, but ohh.. boy is it much more friendly? Even if we see the end of BCB we had our field day so we should not be sorry for all the joy we had. I still hope to hear something new at the BorCon, but that's just me I guess ;-) . With best regards, Boian
  • 2. Thanks Paul for the BorCon2004 C++ Summary
    Your time and effort is appreciated. I'll have to rant later, as I don't have the length of time it would require (and I should probably calm down first). All I will say right now is that Borland should have apologized to everyone who has purchased and upgraded C++Builder over the years- and still should. But I realize that is absolutely unlikely.
  • 3. Definition of primitive types as finite fields
    Is there a particular way to represent the primitive data types of C++ as finite fields? For example, I have an algoritm that I developed in C++, and I would like to define it independently; that is, so that it can be otherwise implemented with the same behavior as the C++ implementation. Is it as simple as saying that: (for 'char') any value 'b' of set 'B' (is a member of set) 0 <= I < 256 or are there more rules to it that need to be incorporated? Also, for 'unsigned short'; does the low word always represent the 'mod 256' of the number, and is the lsb always the low bit (i.e. will '>>' always shift high to low)? Any help you can give is greatly appreciated. I wasn't sure if this was a non-tech post or not, but I thought it was 'not' enough for this board. Thanks. ta0kira
  • 4. Have pity on me...
    I have to do a small application in VC++. It's so slow and it appears much more complicated than Builder. Maybe in a past life I was the bug Grace found. Nate

TCppWebBrowser component

Postby Roland » Wed, 15 Nov 2006 19:33:15 GMT

Dear all,

If I use in BCB6 the TCppWebBrowser component the results are significant
difference in case I use IE6 from Microsoft when I login to a site in this
case my Bank.

I login to my Bank with the URL http:// ..and for some actions the URL is
switched to an https://....... URL.

In the last case I get an error message from my Bank with the BCB6 component
and not with IE6 from Microsoft.

Does anyone know how I can handle this?



Re: TCppWebBrowser component

Postby Remy Lebeau (TeamB) » Thu, 16 Nov 2006 09:53:55 GMT

There should be no difference whatsoever.  TCppWebBrowser is a wrapper for
the Internet Explorer ActiveX control - the exact same control that the
Internet Explorer UI itself uses internally.  So all of the actualy
request/response and parsing logic is identical because it is shared logic.

That is perfectly normal.  'http://' is an unsecure website, whereas
'https://' is secure.  The non-secure website is simply redirectly the
browser to the secure website.  I would expect a Bank website to do that.
Such redirection works exactly the same whether you are using TCppWebBrowser
or the IE UI directly, as it is handles at the HTTP level.  It has nothing
to do with which browser you are using.

What EXACTLY are you seeing happen?  Please be more specific.  What does
your actual code look like?  What is the actual error message?


Re: TCppWebBrowser component

Postby Remy Lebeau (TeamB) » Thu, 16 Nov 2006 09:54:36 GMT

BTW, why did you post a technical question in a non-technical newsgroup?


Re: TCppWebBrowser component

Postby Roland » Thu, 16 Nov 2006 17:46:47 GMT

Sorry Gambit if this is not the newsgroup for this kind of questions.

My actual code is verry simple (or maybe to simple) I use:

A = " http://www.**--****.com/ ";

With this simple code I can login to my Bank.

On there website I wand to change for example my username and password.

The website switches over to a next screen.

In this screen normally I get the possibility to fill in the data but 
nothing happens and I get after a while a message that my session is over.

This happens not when I use IE6 from Microsoft and I can normally change my 


"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM > schreef in bericht 

Re: TCppWebBrowser component

Postby Hans Galema » Thu, 16 Nov 2006 18:53:45 GMT

After that you can click "Inloggen ... " and you get the SesamLoginServlet.
There you can fill in username and password

So where did you click? I do not see an opportunity here to change

Please trim your posts: do not send back everything.


Re: TCppWebBrowser component

Postby Remy Lebeau (TeamB) » Thu, 16 Nov 2006 19:39:27 GMT

Unless 'A' is a WideString, then that code will not compile, as Navigate()
expects a BSTR as its first parameter, not a char* or an AnsiString.

Then what is the actual problem you are having?  I see no problem here so

When I download  http://www.**--****.com/ , I see a link in the HTML that
goes to, which then has username/password fields.
So why not just have TCppWebBrowser go to directly
to begin with?


Re: TCppWebBrowser component

Postby Hans Galema » Thu, 16 Nov 2006 22:36:48 GMT

Which version are you using? AnsiString as well as char* can be used
in Turbo C++ Explorer. Also in many eventhandlers the URL parameter
can now be assigned directly to an AnsiString. (Which was impossible
with bcb5 fot instance).

Or yet more direct:


Re: TCppWebBrowser component

Postby Hans Galema » Thu, 16 Nov 2006 22:40:22 GMT

Sorry. That is for TWebBrowser.

The post here is about TCppWebBrowser.


Re: TCppWebBrowser component

Postby Roland » Fri, 17 Nov 2006 01:37:17 GMT

Hi Hans,

You are right but it is not an login problem.

After you are logged in you have the option to change your password.

And then the site switches to an other screen where you can input your new 
password for example.

And that is the screen where I get the message: "Session over" before I can 
input my new password.

But I can understand that this is difficult to test for you because you must 
have first a username and password to login.

Anyway thanks all for your answers.


"Hans Galema" < XXXX@XXXXX.COM > schreef in bericht 

Re: TCppWebBrowser component

Postby Hans Galema » Fri, 17 Nov 2006 02:02:34 GMT

 > And then the site switches to an other screen ...

What do you mean with 'screen' in this context ?

After login I choose 'Wachtwoord wijzigen'. As a responce an extra window
is opened where I can choose which of the two or both I want to change.

Don't you get that window? If so: why did not you tell? Please state exaxctly
the steps.


Re: TCppWebBrowser component

Postby Remy Lebeau (TeamB) » Fri, 17 Nov 2006 03:57:48 GMT


Sessions are generally tracked in one of two ways:

1) cookies

2) passing session IDs around as part of the URLs

IE handles #2 automatically, whether you are using the main IE UI or
TCppWebBrowser.  #1 is a different matter.  Do you have cookies enabled in
your browser?

You need to talk to the website admin to find out what causes a session to
become invalid.  This is not a browser issue anymore.  As I told you before,
TCppWebBrowser and the IE UI share the SAME ACTIVEX CONTROL, so the runtime
functionality of the browser in each is identical.


Re: TCppWebBrowser component

Postby Remy Lebeau (TeamB) » Fri, 17 Nov 2006 03:59:00 GMT

Are you saying that the "change password" option is handled inside a
separate popup window?  If so, then make sure that the TCppWebBrowser's
OnNewWindow2 event is not preventing popup windows from occuring.


Re: TCppWebBrowser component

Postby Hans Galema » Sat, 18 Nov 2006 17:44:58 GMT

Sorry that I waited so long to answer you. I had let it to Roland
as it is his problem. But it seems that he has gone.

Indeed a new popup window appears. Whatever happens then: it will
never return to the CppWebBrowser. I did not go so far though as
I waited for Roland also to confirm.

That is not enough. It should display that new window itself.


Re: TCppWebBrowser component

Postby Roland » Sun, 19 Nov 2006 19:30:10 GMT

Sorry Gambit and Hans for my late reaction but I had other things to do for 
a few days.

With the remarks off Gambit I get the right popup windows and everything 
seems to work fine accept that I get a script error if I want to leave the 
popup window with 'cancel' or 'ok'.

The error message is: Could not obtain OLE control window handle.

Because I did not know what I had to do in the fastcall NewWindow2 I was 
looking on the web for some statements and found what you see in the text 

I realise that this is not a good way (and maybe stupid) but I hope you can 
help me with the 'CppWebBrowser1NewWindow2' fastcall.

Sorry if the text is to long for the newsgroup.



__fastcall TForm1::TForm1(TComponent* Owner)

                : TForm(Owner)





void __fastcall TForm1::CppWebBrowser1NewWindow2(TObject *Sender,

                  LPDISPATCH *ppDisp, VARIANT_BOOL *Cancel)


 // hier moet wat verbeterd worden i.v.m scripterror bij afsluiten

 // als je het postbank wachtwoord wijzigen scherm invult en daarna afsluit!

 // krijg ik de melding: Could not obtain OLE control window handle

                CppWebBrowser2->Visible = true;

                *ppDisp = CppWebBrowser2->Application;



void __fastcall TForm1::CppWebBrowser1NavigateComplete2(TObject *Sender,

      LPDISPATCH pDisp, Variant *URL)


                if(AnsiString(CppWebBrowser1->LocationURL) != "about:blank")

                Label1->Caption = "URL->  " + CppWebBrowser1->LocationName;

                else Label1->Caption = EmptyStr;



"Hans Galema" < XXXX@XXXXX.COM > schreef in bericht 

Re: TCppWebBrowser component

Postby Hans Galema » Mon, 20 Nov 2006 22:09:22 GMT

In short: you are displaying the contents of the popup window in a second
instance of CppWebBrowser. You should have told so to begin with.

It is perfectly ok.

Then why did you quote all the previous text too? Please trim your quotes.

And why all those extra white lines?

That is ok.

 > .. everything
 > seems to work fine accept that I get a script error if I want to leave the
 > popup window with 'cancel' or 'ok'.

 > The error message is: Could not obtain OLE control window handle.

At the moment you click 'Annuleren' (Cancel) in the second webbrowser,
it's object becomes gray. If you then close the application you get that
message. Why do you think that it is a script message ? Do you mean javascript?
Why do you think so?

You can bring up that message too in another way. After clicking 'Annuleren'
click on a TEdit or a TMemo that is on the same form. There is the message!

Can you confirm this?


Similar Threads:

1.TCppWebBrowser component

2.TCppWebBrowser/MSHTML Component bug

3.Component derived from TCppWebBrowser?

I've seen this question asked a few times over the years, but I've never seen an answer. It seems like a simple enough question. Can you derive a component/class from TCppWebBrowser?

I've tried a real simple test app, which is something like:

class TMyCppWebBrowser : public TCppWebBrowser
  __fastcall TMyCppWebBrowser(TComponent *Comp) :

When you click a button on an otherwise empty form I do something like:

web = TMyCppWebBrowser(this);

web->::TOleControl->Parent = this;  (don't remember exact syntax)


I always get an access violation when it gets to Navigate(). I can use the exact same code, but just replace "TMyCppWebBrowser" with "TCppWebBrowser", and everything works fine. The only thing in my derived class is the required constructor, so how could it be causing anything different to happen?

Could it really be that no one has ever tried to do this, or never succeeded? Can anyone tell me if these issues go away if I was to switch to Delphi and try to derive a new component from TWebBrowser? I'm sure someone has derived a component from that one, right? Come on! Anyone?

The only solution I've come up with so far, but it isn't pretty, is to edit the CPP and HPP files generated by the "import ActiveX control" process. That seems to work, and I know they are just wrappers that the utility spits out, so it seems like that should be safe, but those files are far from pretty, so I really hate to edit them and compile them into my own (very pretty) code.

4.New component - TCppWebBrowser

I created a new component with TCppWebBrowser as the ancestor type. Without
adding any code to it I compiled and installed it. When I tried it in a test
form everything except the TCppWebBrowser functions worked, that is, setting
properties and calling function inherited from COleControl and up is OK but
when calling Navigate2 or GoHome I get an Access violation. Am I supposed to
do something special for this to work? Initialize something? When I inspect
the object everything looks normal...
When using the CppWebBrowser component directly these function work of

The exception notification:
Project wbtest.exe raised exception class EAccessViolation with message
'Access violation at address 00937073. Write of address 00004570'.

Do you know what I need to do to make this work?

Thank you

5.Create TCppWebBrowser dynamically, how to delete/free?


I have a problem using the TCppWebBrowser component dynamically.
My code to create a TCppWebBrowser is:

// In Unit1.h:
TCppWebBrowser *W;

// In Unit1.cpp

void __fastcall TForm1::Button1Click(TObject *Sender)
  W = new TCppWebBrowser(Form1);
  W->ParentWindow = Form1->Handle;

void __fastcall TForm1::Button2Click(TObject *Sender)
  delete W;

I start my application and watch the occupied memory (in taskmanager) and it 
occupies arround 10.000k.
If I click Button1, the browser navigates successfully, the application now 
occupies arround 15.000k

Then I want to delete the TCppWebBrowser component therefore I pressed 
My application then still needs arround 14.700k, so it seems the 
browsercomponent does not release all memory using delete.
What I am doing wrong?
How do I completely release the TCppWebBrowser component and all its 
occupied memory?

Thanks for any help!

6. Stop TCPPWebBrowser Javascript Popup

7. google maps and tcppwebbrowser

8. TCppWebBrowser OnNewWindow2 event

Return to c++ builder


Who is online

Users browsing this forum: No registered users and 62 guest