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 

Get an IWebBrowser2 from TActiveForm

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





PostPosted: Thu Apr 08, 2004 1:00 pm    Post subject: Get an IWebBrowser2 from TActiveForm Reply with quote



Although i'm pretty new to ActiveX and BCB6, i managed to write a simple
Object, that shows my controls on an TActiveForm within my Internet
Explorer. Now i tried to get the URL from the referring page. I found
that IWebBrowser2 has a LocationURL function, which returns the current
URL, but i didn't manage to get it.

I tried to get IWebBrowser2 object by walking through the objects

( IUnknown -> IOleObject -> IOleClientSite -> IServiceProvider ->
IWebBrowserApp -> IWebBrowser2

hr = QueryInterface(IID_IUnknown, (void**)&pUnknown);
if (S_OK == hr)
{
hr = pUnknown->QueryInterface(IID_IOleObject, (void**)&pOObj);
if (S_OK == hr)

....

But even the first QueryInterface returns a null value. I really do not
know where to start. What's wrong whith my code? During my search, i saw
that delphi has a ActiveFormControl property with a valid ClientSite
property. I could't find anything like that in BCB6. Why is this missing?

Thank you very much for your help!

Stefan
Back to top
Alex Bakaev [TeamB]
Guest





PostPosted: Thu Apr 08, 2004 5:37 pm    Post subject: Re: Get an IWebBrowser2 from TActiveForm Reply with quote



Stefan Beetonshu wrote:
Quote:
Although i'm pretty new to ActiveX and BCB6, i managed to write a simple
[snip]



I suggest searching this group (google's advanced groups search should
do)- IIRC, this question was answered in the past.

hth,
..a

Back to top
Stefan Beetonshu
Guest





PostPosted: Tue Apr 13, 2004 7:22 am    Post subject: Re: Get an IWebBrowser2 from TActiveForm Reply with quote



Alex Bakaev [TeamB] wrote:
Quote:
I suggest searching this group (google's advanced groups search should
do)- IIRC, this question was answered in the past.
I've already searched the newsgroups and i searched it again. The only

result for "TActiveForm" and "IWebBrowser2" is refering to my post.
Maybe you can give me a point where to start? Please.

Back to top
Alex Bakaev [TeamB]
Guest





PostPosted: Tue Apr 13, 2004 5:21 pm    Post subject: Re: Get an IWebBrowser2 from TActiveForm Reply with quote

Stefan Beetonshu wrote:

Quote:
Alex Bakaev [TeamB] wrote:

I suggest searching this group (google's advanced groups search should
do)- IIRC, this question was answered in the past.

I've already searched the newsgroups and i searched it again. The only
result for "TActiveForm" and "IWebBrowser2" is refering to my post.
Maybe you can give me a point where to start? Please.


http://tinyurl.com/2rvdx

hth,
..a

Back to top
Stefan Beetonshu
Guest





PostPosted: Mon Apr 19, 2004 3:40 pm    Post subject: Re: Get an IWebBrowser2 from TActiveForm Reply with quote

Alex Bakaev [TeamB] wrote:

Quote:
I suggest searching this group (google's advanced groups search
should do)- IIRC, this question was answered in the past.

No. This has been discussed for Delphi quite a lot, but i think there's
a problem with C++ Builder. I've searched the web again and again, but i
could't find any example for my problem.

Quote:
I've already searched the newsgroups and i searched it again. The only
result for "TActiveForm" and "IWebBrowser2" is refering to my post.
Maybe you can give me a point where to start? Please.

http://tinyurl.com/2rvdx

That example doesn't help. The problem is to receive a proper IOleObject
from a TActiveForm. Trying to get it via ComObject property of
TActiveForm will result in a "TMyActiveForm has not been registered as a
COM class" error. This seems to work for Borland Delphi, but not for C++
Builder.

There is already a question in the newsgroup since Jan 2000 (see
"http://groups.google.de/groups?selm=86q58e%24n0l%241%40nntp1.atl.mindspring.net&oe=UTF-8"),
but there has been no answer to this question yet.

Maybe i've just asked the wrong question so here i go again ;)

How can i get a valid IOleObject within a function of a TActiveForm
created by Borland C++ 6 Wizard? And - yes - i have already searched the
newsgroups and google for information about that!


Stefan

Back to top
Alex Bakaev [TeamB]
Guest





PostPosted: Mon Apr 19, 2004 6:49 pm    Post subject: Re: Get an IWebBrowser2 from TActiveForm Reply with quote

Stefan Beetonshu wrote:
Quote:

http://tinyurl.com/2rvdx


That example doesn't help. The problem is to receive a proper IOleObject
from a TActiveForm. Trying to get it via ComObject property of

The subject of the post is "GetIWebBrowser2 from TActiveForm". The
sample show how to do that.
Quote:

Maybe i've just asked the wrong question so here i go again Wink

Apparently. <g>

Quote:

How can i get a valid IOleObject within a function of a TActiveForm
created by Borland C++ 6 Wizard? And - yes - i have already searched the
newsgroups and google for information about that!



I suggest you take a look at the atlvcl.h file, in particular the
definition of VCLCONTROL_IMPL and then, of the TVclControlImpl; you will
see that your active form derives from IOleObject. So your 'this' is
IOleObject.

hth,
..a

Back to top
Stefan Beetonshu
Guest





PostPosted: Tue Apr 20, 2004 9:45 am    Post subject: Re: Get an IWebBrowser2 from TActiveForm Reply with quote

Alex Bakaev [TeamB] wrote:
Quote:
I suggest you take a look at the atlvcl.h file, in particular the
definition of VCLCONTROL_IMPL and then, of the TVclControlImpl; you will
see that your active form derives from IOleObject. So your 'this' is
IOleObject.

That wasn't the clue either. But i think i found out what went wrong...

I tried to get an IOleObject within my VCL control (TMyActiveFormCtrl),
but i can't reach the IOleObject from here. I have to get my IOleObject
from my "Control Implementation" (TMyActiveFormCtrlImpl). This is indeed
a descendant from IOleObject and so, "IOleObject* pMyOO = this" will
succeed. Now i have to find a way to pass it to my VCL control, but i
think i can manage that.

Stefan






Back to top
Alex Bakaev [TeamB]
Guest





PostPosted: Tue Apr 27, 2004 12:21 am    Post subject: Re: Get an IWebBrowser2 from TActiveForm Reply with quote

Stefan Beetonshu wrote:
Quote:
Alex Bakaev [TeamB] wrote:

I suggest you take a look at the atlvcl.h file, in particular the
definition of VCLCONTROL_IMPL and then, of the TVclControlImpl; you
will see that your active form derives from IOleObject. So your 'this'
is IOleObject.


That wasn't the clue either. But i think i found out what went wrong...

I agree. That wasn't the clue. It was a direct pointer.


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.