我正在尝试使用Inno设置我的软件。目前,我的软件每天从不同的Geo上下载超过6000次。问题是我的软件对每个geo执行的不同,所以我为每个geo创建了不同的exe。目前正在使用Inno设置作为我的软件的下载管理器。现在,如何找到用户是从哪个geo,以及我如何告诉我的Inno安装脚本下载的exe,哪里的用户是从。
目前我所拥有的是:
#define MyAppName ""
#define MyAppVersion "1"
#define _URL ""
#define _exeFileName "setup.exe"
#include ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Downloader','ScriptPath','');
[Setup]
AppId={{7B0D8E4E-BAFD-400B-B775-0DD7D8FBAE08}
AppName={#MyAppName}
AppVersion={#MyAppVersion};
AppVerName={#MyAppName} {#MyAppVersion}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
DisableFinishedPage=yes
OutputBaseFilename={#MyAppName}{#MyAppVersion}
Compression=lzma
SolidCompression=yes
DisableWelcomePage=yes
DisableReadyPage=yes
DisableReadyMemo=True
Uninstallable=no
RestartIfNeededByRun=no
CreateAppDir=False
UsePreviousGroup=False如果有人能帮我解决这个问题,那就太好了。
提前感谢
发布于 2016-03-24 08:21:54
我不知道什么是解决这个位置的最好方法。这是另一个问题。
但你可以使用一些在线服务。
它返回一个两位数的ICO国家代码。
您可以使用WinHttpRequest读取代码。请参阅How to read a text file from the Internet resource?
下面的示例演示如何将其与Inno下载插件相结合:
var
Country: string;
function GetCountry: string;
var
WinHttpReq: Variant;
begin
if Country <> '' then
begin
Log(Format('Using cached country: %s', [Country]));
Result := Country;
end
else
begin
try
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('GET', 'https://ipinfo.io/country', False);
WinHttpReq.Send;
Result := Trim(WinHttpReq.ResponseText);
except
Log(GetExceptionMessage);
Result := 'XX';
end;
Country := Result;
Log(Format('Resolved country: %s', [Country]));
end;
end;
function InitializeSetup(): Boolean;
begin
idpAddFile(
'https://example.com/file-for-' + GetCountry + '.exe',
ExpandConstant('{tmp}\file.exe'));
end;顺便说一句,你有没有考虑在下载的时候解决你网站上的地理位置问题?让用户直接下载特定于他/她位置的安装程序?
https://stackoverflow.com/questions/36194647
复制相似问题