Estuve haciendo un par de pruebas en Inno setup, y teniendo en cuenta que es el primer script que hago no parece muy difícil. Añadí la dll "Puertos.dll" a los archivos del proyecto y utilizo el siguiente script:
Código:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
AppName=My Program
AppVerName=My Program 1.5
AppPublisher=My Company, Inc.
AppPublisherURL=http://www.example.com/
AppSupportURL=http://www.example.com/
AppUpdatesURL=http://www.example.com/
CreateAppDir=no
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "C:\Puertos.dll"; DestDir: "{tmp}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[code]
//importing a Windows API function
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer;
external 'MessageBoxA@user32.dll stdcall';
//importing a custom DLL function
function EstaOcupado(Puerto: Integer): Boolean;external 'EstaOcupado@files:Puertos.dll stdcall';
function NextButtonClick(CurPage: Integer): Boolean;
var
hWnd: Integer;
begin
if CurPage = wpWelcome then begin
hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));
if EstaOcupado(80) then
MessageBox(hWnd, 'Esta ocupado', 'MessageBoxA', MB_OK)
else
MessageBox(hWnd, 'No esta ocupado', 'MessageBoxA', MB_OK);
end;
Result := True;
end;