我的Inno Setup安装程序无法在所有计算机上正确加载vb6程序

问题描述

我是InnoSetup编码的新手。我正在尝试在一堆Windows 10专业版计算机上安装旧的Visual Basic 6程序。在一半的计算机上,安装正常,程序成功运行。但是,在其他计算机上,安装成功,但是该程序未运行。程序界面如下:

bad interface

何时应如下所示:

good interface

这是我的安装代码的副本:

#define MyAppName "Winapex 1501"
#define MyAppVersion "1.0"
#define MyAppPublisher "Blackland Research Center"
#define MyAppURL "http://blackland.tamu.edu/"
#define MyAppExeName "WinApex.exe"
#define MyAppIcoName "WinAPEX_2.ico"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID,click Tools | Generate GUID inside the IDE.)
AppId={{5B7299DB-CD69-41AD-AF8A-D82B4E37E676}
AppName={#MyAppName}
AppVersion={#MyAppVersion} 
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
UsePrevIoUsAppDir=no
DefaultDirName=C:\APEX\WinAPEX1501
disableProgramGroupPage=yes
OutputBaseFilename=Winapex1501setup64
Compression=lzma
SolidCompression=yes
disableWelcomePage=no
disableDirPage=no
CreateAppDir=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]

Source: "D:\WinAPEX1501\WinApex.exe"; DestDir: "{app}"; Flags: ignoreversion  
Source: "D:\WinAPEX1501\WinAPEXpath.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\WinAPEX1501\WinAPEXpath.txt";  DestDir: "C:\Program Files\"; Flags: ignoreversion

Source: "D:\OneDrive - agnet.tamu.edu\Documents\WinAPEX 1501 install\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

; begin VB system files
; (Note: Scroll to the right to see the full lines!)
Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\stdole2.tlb";  DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile regtypelib
Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\msvbvm60.dll"; DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\oleaut32.dll"; DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\olepro32.dll"; DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\asycfilt.dll"; DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile
Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\comcat.dll";   DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile regserver

Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\dbadapt.dll";   DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\MSBind.dll";   DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\MSDbRptr.dll";   DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\msrdo20.dll";   DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\MsstDFMT.DLL";   DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\msstkprp.dll";   DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile regserver
// Source: "D:\Winapex JayHawk\WinAPEX\vbfiles\comdlg32.dll";   DestDir: "{sys}"; OnlyBelowVersion: 0,6; Flags: restartreplace uninsneveruninstall sharedfile regserver
; end VB system files

; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "D:\Winapex JayHawk\WinAPEX\ComDlg32.ocx"; DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\MSFlxGrd.ocx"; DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\Resize32.ocx"; DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\richtx32.ocx"; DestDir: "{sys}"; Flags: restartreplace sharedfile regserver

Source: "D:\Winapex JayHawk\WinAPEX\ComCt232.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\comct332.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\comctl32.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
; Source: "D:\Winapex JayHawk\WinAPEX\dbadapt.dll";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\dbgrid32.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\dblist32.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\mci32.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\msadodc.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
; Source: "D:\Winapex JayHawk\WinAPEX\msbind.dll";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\mschrt20.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\mscomct2.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\mscomctl.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\mscomm32.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\msdatGrd.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\msdatlst.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\msdatrep.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
; Source: "D:\Winapex JayHawk\WinAPEX\msdbrptr.dll";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\mshflxgd.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\msinet.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\msmapi32.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\msmask32.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\msrdc20.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
; Source: "D:\Winapex JayHawk\WinAPEX\msrdo20.dll";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
; Source: "D:\Winapex JayHawk\WinAPEX\msstdfmt.dll";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
; Source: "D:\Winapex JayHawk\WinAPEX\msstkprp.dll";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\comct232.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\mswinsck.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\picclp32.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\sysinfo.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver
Source: "D:\Winapex JayHawk\WinAPEX\tabctl32.ocx";   DestDir: "{sys}"; Flags: restartreplace sharedfile regserver

Source: "D:\Winapex JayHawk\WinAPEX\dependencies\NDP462-KB3151800-x86-x64-AllOS-ENU.exe"; DestDir: {tmp}; Flags: deleteafterinstall; AfterInstall: InstallFramework; Check: FrameworkIsnotinstalled

[Code]
function FrameworkIsnotinstalled: Boolean;
begin
  Result := not RegKeyExists(HKEY_LOCAL_MACHINE,'Software\Microsoft\.NETFramework\policy\v4.0');
end;

procedure InstallFramework;
var
  StatusText: string;
  ResultCode: Integer;

begin
  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing .NET framework...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    begin
      if not Exec(ExpandConstant('{tmp}\NDP462-KB3151800-x86-x64-AllOS-ENU.exe'),'/q /norestart','',SW_SHOW,ewWaitUntilTerminated,ResultCode) then
        begin
        // you can interact with the user that the installation Failed
        MsgBox('.NET installation Failed with code: ' + IntToStr(ResultCode) + '.',mbError,MB_OK);
        end;
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstnormal;
  end;
end;

function CreateBatch(): boolean;
var
  fileName : string;
  lines : string;
begin
  Result := true;


 
  // fileName := ExpandConstant('{app}\directory.txt');    
  fileName := ExpandConstant('C:\Program Files\WinAPEXpath.txt'); 
  lines := ExpandConstant('{app}');    
  Result := SaveStringToFile(filename,lines,false);   
  exit;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if  CurStep=sspostInstall then
    begin
         CreateBatch();
    end
end;




[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\{#MyAppIcoName}"  
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
; Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\{#MyAppIcoName}"; Tasks: desktopicon
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\{#MyAppIcoName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName,'&','&&')}}"; Flags: Nowait postinstall skipifsilent

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)