Creating and Using TWebbrowser dynamically

Giganews Newsgroups
Subject:Creating and Using TWebbrowser dynamically
Posted by: tglunz@nospam.comvantage.com
Date:Tue, 27 Mar 2007

Hi..

I am building an application where I need to dynamically create TWebBrowser
in D7.  I am able to do everything I need to, but I am hoping to use the
"OnDocumentComplete" event.  I created the procedure as follows for this:
procedure TImageArea1Form.WebBrowser1DocumentComplete(Sender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
Begin
  // my code her
end;

I create the TWebBrowser component by:
WebBrowser1 := TWebBrowser.Create(Self);

I tried adding the event:
WebBrowser1.OnDownloadComplete := WebBrowser1DocumentComplete;

But, when I try to compile I get the error:
Parameter list differs

I tried adding the event based on the additional parameters, but this won't
compile either:
WebBrowser1.OnDownloadComplete := WebBrowser1DocumentComplete(nil,
WebBrowser1.Document, URL);
The error is:
Incapatable types: 'TNotifyEvent' and 'Procedure'

Any thoughts on how this can be done?

Thanks in advance,
Tom

Replies