OnNewWindow2
Occurs when a new window is to be created for
displaying a resource.
Some actions that can cause this include the user shift-clicking on
a link, the user right-clicking on a link and choosing "open in
new window," or a targeted navigation to a frame name that does
not yet exist.
Your browser application can also trigger this event by calling the
Navigate or Navigate2 method with the navOpenInNewWindow
flag.
The WebBrowser control has an opportunity to handle the new window
creation itself. If it does not, a top-level Internet Explorer
window is created as a separate (nonhosted) process.
procedure
TForm1.EmbeddedWB1NewWindow2(Sender: TObject;
var ppDisp: IDispatch; var Cancel: WordBool);
|
-
-
- ppDisp
- An object expression that, optionally, receives
a new, hidden Webbrowser or Internet Explorer object with no URL
loaded.
- Cancel
- A Boolean value that, when set to TRUE, is used
to cancel the navigation.
Set Value of Cancel=TRUE to disable displaying of a
new window.
Set ppDisp to EmbeddedWb.Application of the
webbrowser you want the url to be displayed in:
procedure
TForm1.EmbeddedWB1NewWindow2(Sender: TObject;
var ppDisp: IDispatch; var Cancel: WordBool);
begin
ppdisp := EmbeddedWB2.Application_;
end;
|
In the following sample a new instance of your
webbrowser application is created instead of a top-level Internet
Explorer window.
procedure
TForm1.EmbeddedWB1NewWindow2(Sender: TObject;
var ppDisp: IDispatch; var Cancel: WordBool);
var
NewApp: TForm1;
begin
NewApp := TForm1.Create(Owner);
NewApp.Visible := true;
ppdisp := NewApp.EmbeddedWB1.Application_;
end;
|
Link:
HOWTO:
Use the NewWindow2 event