VB   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了vb6 – 如何使用InnoSetup进行静默安装?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我需要在下一个安装向导过程中为我的应用程序启动静默安装.请任何人帮助我.
在静默模式下运行设置的正确方法是,始终使用 /SILENT命令行参数执行它.例如这样:
setup.exe /SILENT

在我们在评论中澄清了您的要求后,我看到,您确实想要构建一个设置,它将在没有提到的命令行参数的情况下以静默模式运行.目前,没有内置的方法告诉编译器,您要构建静默设置,因此我们需要通过在初始化设置时使用/SILENT命令行参数重新运行设置来解决此问题.

以下脚本显示了此解决方法:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Code]
#ifdef UNICODE
  #define AW "W"
#else
  #define AW "A"
#endif
type
  HINSTANCE = THandle;

function ShellExecute(hwnd: HWND; lpOperation: string; lpFile: string;
  lpParameters: string; lpDirectory: string; nShowCmd: Integer): HINSTANCE;
  external 'ShellExecute{#AW}@shell32.dll stdcall';

function InitializeSetup: Boolean;
begin
  // if this instance of the setup is not silent which is by running
  // setup binary without /SILENT parameter,stop the initialization
  Result := WizardSilent;
  // if this instance is not silent,then...
  if not Result then
  begin
    // re-run the setup with /SILENT parameter; because executing of
    // the setup loader is not possible with ShellExec function,we
    // need to use a WinAPI workaround
    if ShellExecute(0,'',ExpandConstant('{srcexe}'),'/SILENT',SW_SHOW) <= 32
    then
      // if re-running this setup to silent mode failed,let's allow
      // this non-silent setup to be run
      Result := True;
  end;
end;

大佬总结

以上是大佬教程为你收集整理的vb6 – 如何使用InnoSetup进行静默安装?全部内容,希望文章能够帮你解决vb6 – 如何使用InnoSetup进行静默安装?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: