What you're asking would require specific JavaScript interop which is not easy to implement. Hence I would suggest you making those edit boxes in JavaScript from where you will interop with the Google Maps API and read the values once you leave the page with the browser. I've added the access to the OleObject through the new WebBrowserGetOleObject function to the plugin.
Here is an example JavaScript with 2 input boxes (that you will synchronize from Google Maps API in your script). This script is in the following example referred by the fixed file name (in real change that to a temporary file extracted from the setup package):
<!DOCTYPE html>
<html>
<body>
<input id="latinput" type="text">
<input id="loninput" type="text">
</body>
</html>
In Inno Setup you can then read values from those input boxes this way:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Files]
Source:"WebBrowser.dll"; Flags: dontcopy
[Code]
const
EVENT_BEFORE_NAVIGATE = 1;
EVENT_FRAME_COMPLETE = 2;
EVENT_DOCUMENT_COMPLETE = 3;
type
TWebBrowserEventProc = procedure(EventCode: Integer; URL: WideString);
procedure WebBrowserCreate(ParentWnd: HWND; Left, Top, Width, Height: Integer;
CallbackProc: TWebBrowserEventProc);
external 'WebBrowserCreate@files:webbrowser.dll stdcall';
procedure WebBrowserDestroy;
external 'WebBrowserDestroy@files:webbrowser.dll stdcall';
procedure WebBrowserShow(Visible: Boolean);
external 'WebBrowserShow@files:webbrowser.dll stdcall';
procedure WebBrowserNavigate(URL: WideString);
external 'WebBrowserNavigate@files:webbrowser.dll stdcall';
function WebBrowserGetOleObject: Variant;
external 'WebBrowserGetOleObject@files:webbrowser.dll stdcall';
var
CustomPage: TWizardPage;
procedure InitializeWizard;
begin
CustomPage := CreateCustomPage(wpWelcome, 'Web Browser Page',
'This page contains web browser');
WebBrowserCreate(WizardForm.InnerPage.Handle, 0, WizardForm.Bevel1.Top,
WizardForm.InnerPage.ClientWidth, WizardForm.InnerPage.ClientHeight - WizardForm.Bevel1.Top, nil);
WebBrowserNavigate('C:\AboveScript.html');
end;
procedure DeinitializeSetup;
begin
WebBrowserDestroy;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
WebBrowserShow(CurPageID = CustomPage.ID);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
Latitude: Variant;
Longitude: Variant;
OleObject: Variant;
begin
Result := True;
if CurPageID = CustomPage.ID then
begin
OleObject := WebBrowserGetOleObject;
if not VarIsNull(OleObject) then
begin
Latitude := OleObject.Document.GetElementByID('latinput').value;
Longitude := OleObject.Document.GetElementByID('loninput').value;
MsgBox(Format('Lat: %s, Lon: %s', [Latitude, Longitude]), mbInformation, MB_OK);
end;
end;
end;
OleObjectthrough which you can access its document (search for a Delphi example that is usingTWebBrowser.OleObject.Document.GetElementByID('ElementId')..., the sameOleObjectyou can get by theWebBrowserGetOleObjectfunction in this version). - TLama