Hi,

Thanks for the reply.  Sorry for the slight delayed response.

I'm having trouble getting this to work.  I've changed the code so it refers
to my activeform, and so on, but when it comes to running it, it doesn't
seem to do anything.

I put a few checks in around here:

if Supports(Form, IOleObject, OleObj) and (OleObj.GetClientSite(Site) =
S_OK) then

The first check doesn't succeed.  What am I doing wrong?

Neil.

> > Hi,
> >
> > I need to make an Active Form in Delphi 5 which will run as 
> part of a
> > webpage.  As part of this, I need to be able to obtain the 
> URL of the
> > browser window hosting the Active Form, and change it to something
> > else (like those Flash navigation menus you see do).
> >
> > Can this be done?
> 
> It should be possible. I've not worked with ActiveForms for a 
> long time, but 
> IIRC you can get a handle/reference to the hosting 
> webbrowser's interface 
> (IWebBrowser2).  This does expose the lcoation URL, and also 
> methods for 
> navigaitng to a new url.  (Compare for example the methods 
> and properties 
> surfaced by the TWebBrowser VCL wrapper for the IWebBrowser2 
> interfac, see 
> also for example 
> http://msdn.microsoft.com/workshop/browser/webbrowser/referenc
> e/ifaces/iwebbrowser2/iwebbrowser2.asp)
> 
> <pause>
> 
> Update: I've just googled it and found an example:
> 
> uses SHDocVw, MSHTML_TLB;
> var
>   Form: IMyActiveForm;
>   OleObj: IOleObject;
>   Site: IOleClientSite;
>   Container: IOleContainer;
>   Doc: IHTMLDocument2;
>   ServiceProvider: IServiceProvider;
>   WB: IWebBrowser2;
> ..
>   if Supports(Form, IOleObject, OleObj) and
>     (OleObj.GetClientSite(Site) = S_OK) then
>   begin
>     OleCheck(Site.GetContainer(Container));
> 
> 
>     { Get the HTML document, if you want it }
>     Doc := Container as IHTMLDocument2;
> 
> 
>     { Get the browser itself }
>     ServiceProvider := Container as IServiceProvider;
>     ServiceProvider.QueryService(
>               IWebBrowserApp, IWebBrowser2, WB);
> 
> 
>     { Do something with them }
>     Caption := WB.FullName + ' ' + Doc.tostring;
> 
> 
> 
> HTH
> 
> 
> 
> Walter Prins
> 
> 
> 
> 
> 
> 
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: [EMAIL PROTECTED] 
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to