Share 发表于 2017-5-30 05:27:59

让inno启动时必须联网才能启动安装程序


function InternetCheckConnection (lpszUrl: string; dwFlags: integer; dwReserved: integer): boolean;
external 'InternetCheckConnectionW@wininet.dll stdcall';

function InitializeSetup (): Boolean;
begin
if InternetCheckConnection('http://www.hanzify.org/', 1, 0) then
result:= true
else
begin
result:= false;
    MsgBox('你还没有与互联网连接,安装程序无法继续!', mbInformation, MB_OK);
end;
end;


ANSI 和 Unicode 版都通用的代码是:

#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif

function InternetCheckConnection (lpszUrl: string; dwFlags: integer; dwReserved: integer): boolean;
external 'InternetCheckConnection{#A}@wininet.dll stdcall';

function InitializeSetup (): Boolean;
begin
if InternetCheckConnection('http://www.hanzify.org/', 1, 0) then
result:= true
else
begin
result:= false;
    MsgBox('你还没有与互联网连接,安装程序无法继续!', mbInformation, MB_OK);
end;
end;
页: [1]
查看完整版本: 让inno启动时必须联网才能启动安装程序