Solved

Delphi 6 TWebBrowser question

Posted on 2009-05-06
7
266 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 250 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
System restore point 4 91
indy Tidtcpserver best  way to brodcast message to multiable clients 1 145
Magic Software info 18 125
LAN or WAN ? 11 81
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

919 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now