Hi I'm trying to import the ExecDos.dll into my Inno Setups install for live logging the installation process. I copied the DLL into the folder where the .iss file is located (Downloaded it from NSIS) and tried importing it like this:
[Files]
Source: "ExeDos.dll"; DestDir: "{tmp}"; Flags: dontcopy
[Code]
// Import ExecDos from DLL
procedure ExecDos(const CmdLine: String; const OutputCallback: LongWord);
external 'ExecDos@files:ExecDos.dll stdcall';
I get an error:
Error
Runtime error (at -1:0):
Cannot import
dll:<utf8>C:\Users\my-user\AppData\Local\Temp\is-6LOEC.tmp\ExecDoc.dll
I've tried importing different DLL types: unicodeX84/X64 and ansiX84/X64 but nothing really works
-- EDIT attaching my code:
[Code]
var
OutputPage: TWizardPage;
OutputMemo: TMemo;
procedure AddLine(S: PAnsiChar);
begin
OutputMemo.Lines.Add(S);
OutputMemo.SelStart := Length(OutputMemo.Text); // auto-scroll
end;
// Import ExecDos from DLL
procedure ExecDos(const CmdLine: String; const OutputCallback: LongWord);
external 'ExecDos@files:ExecDos.dll stdcall';
procedure InitializeWizard;
begin
// Create a custom page for progress output
OutputPage := CreateCustomPage(wpInstalling,
'Installation Progress',
'The installation is running. Please wait...');
OutputMemo := TMemo.Create(OutputPage.Surface);
OutputMemo.Parent := OutputPage.Surface;
OutputMemo.Align := alClient;
OutputMemo.ScrollBars := ssVertical;
OutputMemo.ReadOnly := True;
end;
procedure RunBatch(const BatchFile: string);
begin
ExecDos('"' + BatchFile + '"', CreateCallback(@AddLine));
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
RunBatch('\\MyServer\InstallScripts\script1.bat');
RunBatch('\\MyServer\InstallScripts\script2.bat');
RunBatch('\\MyServer\InstallScripts\script3.bat');
end;
end;
managed to solve it with delayload:
// Import ExecDos from DLL
procedure ExecDos(const CmdLine: String; const OutputCallback: LongWord);
external 'ExecDos@files:ExecDos.dll stdcall delayload';