OnGetExternal
NewsProductsDownloadsSupportForumCredits

TEmbeddedWB 
History 
HtmlEdit 
TIEAddress 
TIEDownload 
TIEDownloadManager 
IEGuid 
TIEParser 
Favorites 
TIESecurityManager 
IE5Tools 
TIETravelLog 
TLinksBar 
Protocols 
TRichEditWB 
TWebUpdater 
ResourceTool 
UI - lessParser 
Delphi Links 

 

 

[Home][Support][TEmbeddedWB][Events][OnGetExternal]


OnBeforeNavigate2OnCommandStateChangeOnDocumentCompleteOnDownloadBeginOnDownloadCompleteOnFullScreenOnGetExternalOnGetHostInfoOnGetOptionKeyPathOnMenuBarOnNavigateComplete2OnNavigateErrorOnNewWindow2OnQuitOnProgressChangeOnPropertyChangeOnScriptError EventOnShowContextMenuOnShowDialogOnShowHelpOnShowMessageOnStatusBarOnStatusTextChangeOnTheaterModeEventOnTitleChangeOnToolbar EventOnTranslateAcceleratorOnTranslateUrlOnUpdateUIOnVisible

 

OnGetExternal

 

OnGetExternal is called to obtain an IDispatch interface. 
That is in simple words, the way to interact with the browser page, send and recive data.
The following demo shows the interaction  between GetExternal,  Invoke and GetIDsofNames. 

We want the PageSetup-Dialog to be shown, when window.external.pagesetup is called from a script.  If you use the following html-code pagesetup-dialog will pop up when you click a button on the page.

 

Save this code to a file 'Sample.htm':

<HTML><HEAD><TITLE>EmbeddedWB Sample</TITLE>
<SCRIPT>
function doit()
{
window.external.pagesetup;
}
</SCRIPT>
</HEAD>

<BODY>
Click the button to open Webbrowsers Pagesetup-dialog:
<P>
<input type=button 
value="Show Pagesetup"
onClick="doit()">
</BODY></HTML>

Add the following functions to your EmbeddedWB-application:



procedure TForm1.Button1Click(Sender: TObject);
begin
EmbeddedWb1.Go('sample.htm');
end;


function TForm1.EmbeddedWB1GetExternal(out ppDispatch: IDispatch): HRESULT;
begin
ppDispatch := EmbeddedWB1 as IDispatch;
Result := S_OK;
end;

function TForm1.EmbeddedWB1Invoke(DispID: Integer; const IID: TGUID;
LocaleID: Integer; Flags: Word; var Params: tagDISPPARAMS; VarResult,
ExcepInfo, ArgErr: Pointer): HRESULT;
begin
if
DispId = 1 then begin
EmbeddedWb1.PageSetup;
Result := S_OK;
end else
result := inherited invoke(dispid, iid, localeid, flags, params, varresult,
ExcepInfo, argerr);
end;

function TForm1.EmbeddedWB1GetIDsOfNames(const IID: TGUID; Names: Pointer;
NameCount, LocaleID: Integer; DispIDs: Pointer): HRESULT;
var
oslNames: POleStrList;
pdidDispIds: PDispIDList;
begin
OslNames := Names;
pdidDispIDs := DispIds;
if Lowercase(oslNames[0]) = 'pagesetup' then
begin
Result := S_OK;
pdidDispIDs[0] := 1;
end else
Result := inherited GetIDsOfNames(IID, names, NameCount, LocaleID, DispIDs);
end;

 

 

If you want to explore the full power of OnGetExternal you can download the following demo by Christopher Fairbairn. It shows a different (and more proper) way to use OnGetExternal.

 

Download OnGetExternal Demo by C. Fairbairn

OnGetExternal Demo for Delphi 4 & 5

[Home][News][Products][Downloads][Support][Forum][Credits]

Created   by
Per Lindsų Larsen

Copyright (c) 2005 bsalsa productions. All rights reserved.

bsalsa@bsalsa.no-ip.info