Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Delphi 6 TWebBrowser question

Posted on 2009-05-06
7
Medium Priority
?
276 Views
Last Modified: 2012-05-06
How to create a new Web Page from the OnNewWindow2 event?
0
Comment
Question by:sepknow
  • 3
  • 3
7 Comments
 
LVL 8

Expert Comment

by:BdLm
ID: 24326131
do you know that link :  http://www.cryer.co.uk/brian/delphi/
0
 
LVL 8

Accepted Solution

by:
BdLm earned 1000 total points
ID: 24326207
does this help ?

function TDemoForm.NewBrowserTab(pc: TPageControl): TTabSheet;
var
  wb: TWebBrowser;
begin
  Result := TTabSheet.Create(pc);
  Result.PageControl := pc;
  wb := TWebBrowser.Create(Result);
  wb.Align := alClient;
  Result.InsertControl(wb);
  wb.OnNewWindow2 := NewWindow2;
  wb.OnBeforeNavigate2 := BeforeNavigate2;
end;

Open in new window

0
 

Author Comment

by:sepknow
ID: 24326432
Thanks, BdLm.
I did this, but the new web page was not displayed in the new tabsheet. Instead a new IE was launched with the new web page.
Could you help?
Thank you in advance.

procedure TForm3.IE6NewWindow2(Sender: TObject; var ppDisp: IDispatch; var Cancel: WordBool);
var
  mTabSheet: TTabSheet;
  mWebBrowser: TWebBrowser;
begin
  mTabSheet := TTabSheet.Create(PageControl1);
  mTabSheet.Caption := 'blank';
  mTabSheet.Name := 'tsNewPage_' + FormatDateTime('yyyymmddhhnnsszzz', now); // just a unique name
  mTabSheet.PageControl := PageControl1;
  mTabSheet.Parent := PageControl1;
  PageControl1.ActivePage := mTabSheet;
  mWebBrowser := TWebBrowser.Create(mTabSheet);
  mTabSheet.InsertControl(mWebBrowser);
  TWinControl(mWebBrowser).Name := 'WB_' + FormatDateTime('yyyymmddhhnnsszzz', now); // just a unique name
  TWinControl(mWebBrowser).Parent := mTabSheet;
  mWebBrowser.Align := alClient;
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 26

Expert Comment

by:EddieShipman
ID: 24335962
You have to set the ppDisp to point to the new webbrowser.
Something like this...
ppDisp := mwebBrowser.ControlInterface;
0
 
LVL 26

Assisted Solution

by:EddieShipman
EddieShipman earned 1000 total points
ID: 24336012
Don't forget to add this line, too, so the new window will do the same thing:
  mWebBrowser.OnNewWindow2 := IE6NewWindow2;
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 24336032
Oh, and another thing, make sure you destroy the new webbrowser instances and TTabSheets
when closing your form.
0
 
LVL 8

Expert Comment

by:BdLm
ID: 24336102
may be you can use a oblectlist for that administrative job  -->  http://www.howtodothings.com/computers/a1110-using-tobjectlist.html

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question