Ver Mensaje Individual
  #4  
Antiguo 19-12-2004
Avatar de Héctor Randolph
[Héctor Randolph] Héctor Randolph is offline
Miembro Premium
 
Registrado: dic 2004
Posts: 882
Reputación: 20
Héctor Randolph Va por buen camino
Cita:
Empezado por Yoli
lo quiero hacer obteniendo el serial del disco duro al momento de ejecurtase el instalador de la aplicacion (INNO SETUP)
Hola YOLI!

Aquí te muestro un script para conocer el serial del disco duro desde Inno Setup, espero que te sea útil.

Tomado de la página

Inno Setup Knowledge Base/How to get drive volumen and serial number

[code]


;
; ISX 3.0.6.2
;

[Setup]
AppName=DriveVolume
AppVerName=DriveVolume
Uninstallable=false
UpdateUninstallLogAppName=false
DisableDirPage=true
DisableProgramGroupPage=true
DefaultDirName={pf}\DriveVolume
DisableStartupPrompt=true

[_ISTool]
EnableISX=true

Código:
function GetVolumeInformation(
	lpRootPathName: PChar;
	lpVolumeNameBuffer: PChar;
	nVolumeNameSize: LongInt;
	var lpVolumeSerialNumber: LongInt;
	lpMaximumComponentLength: LongInt;
	lpFileSystemFlags : LongInt;
	lpFileSystemNameBuffer: PChar;
	nFileSystemNameSize: LongInt ) : Integer;
external 'GetVolumeInformationA@kernel32.dll stdcall';

{ // API declaration in C
BOOL GetVolumeInformation(
  LPCTSTR lpRootPathName,           // root directory
  LPTSTR lpVolumeNameBuffer,        // volume name buffer
  DWORD nVolumeNameSize,            // length of name buffer
  LPDWORD lpVolumeSerialNumber,     // volume serial number
  LPDWORD lpMaximumComponentLength, // maximum file name length
  LPDWORD lpFileSystemFlags,        // file system options
  LPTSTR lpFileSystemNameBuffer,    // file system name buffer
  DWORD nFileSystemNameSize         // length of file system name buffer
);
}

function GetLastError( ) : Integer;
external 'GetLastError@kernel32.dll stdcall';

function InitializeSetup(): Boolean;

var srcdisk, volume: String;
    ercode: Integer; sernum: LongInt;
begin
  Result := true;

  srcdisk := AddBackslash( ExtractFileDrive( ExpandConstant('{srcexe}') ) );
  volume := StringOfChar( ' ', 16 );

  if GetVolumeInformation( srcdisk, volume, 15, sernum, 0, 0, '', 0 ) = 0 then
    begin
      ercode := GetLastError();
      MsgBox( SysErrorMessage( ercode ), mbError, MB_OK );
      Result := false;
    end
  else begin
    volume := CastIntegerToString( CastStringToInteger(volume) );
    MsgBox( Format3( 'Volume of %s is (%s) serial is %s', srcdisk, volume, IntToStr(sernum) )
      , mbInformation, MB_OK );
  end;
end;
Responder Con Cita