I am new to InnoSetup coding. I'm trying to install an old Visual Basic 6 program on a bunch of Windows 10 pro machines. On half the machines, the installation works and the program runs successfully. However, on the other machines, the installation is successful, but the program does not run. The program interface looks like this:
when it should look like this:
Here is a copy of my installation code:
#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