Portál AbcLinuxu, 9. května 2025 23:36

Dotaz: inno pascal iss

12.8.2011 16:47 adrinko | skóre: 22
inno pascal iss
Přečteno: 274×
Odpovědět | Admin
zdravím, v iss používam tento kód na zistenie, či aplikácia beží alebo nie
[Code]
////////// zaciatok psvince.dll //////////
const
  ProgramName = 'notepad';
  ProgramExeName = 'notepad.exe';

  ProgramRunningOnInstallMessage = ProgramName + ' is currently running. ' + #13 + #13 + 'Please close it and then click on ''Retry'' to proceed with the installation.';
  InstallationCanceledMessage = 'The installation was canceled.';

  ProgramRunningOnUninstallMessage = ProgramName + ' is currently running. ' + #13 + #13 + 'Please close it and then click on ''Retry'' to proceed.';
  UninstallationCanceledMessage = 'The uninstallation process was canceled.';

// IsModuleLoadedI - function to call at install time
// Also added setuponly flag
function IsModuleLoadedI(modulename: AnsiString ):  Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall setuponly';

// IsModuleLoadedU - function to call at uninstall time
// Also added uninstallonly flag
function IsModuleLoadedU(modulename: AnsiString ):  Boolean;
external 'IsModuleLoaded@{app}\psvince.dll stdcall uninstallonly' ;

function IsModuleLoaded( modulename: String; isUninstallation: Boolean ): Boolean;
begin
  if isUninstallation then
    Result := IsModuleLoadedU( modulename )
  else
    Result := IsModuleLoadedI( modulename );
end;

//------------------------------------------------------------------------------

// Prompt the user to close a program that's still running.
// Finish when the executable is closed or the user cancels the process.

//  -> message : A message to show the user to prompt them to close 
//  -> isUninstallation : Whether this is an uninstallation (to call the right function.)
// <-  True if the program was closed (or was not running),
//     False if the user clicked on the Cancel button and didn't close the program

function PromptUntilProgramClosedOrInstallationCanceled(message: String; isUninstallation: Boolean ): Boolean;
var
  ButtonPressed : Integer;
begin
  ButtonPressed := IDRETRY;

  // Check if the program is running or if the user has pressed the cancel button
  while IsModuleLoaded( ProgramExeName, isUninstallation ) and ( ButtonPressed <> IDCANCEL ) do
  begin
    ButtonPressed := MsgBox( message , mbError, MB_RETRYCANCEL );    
  end;

  // Has the program been closed?
  Result := Not IsModuleLoaded( ProgramExeName, isUninstallation );
end;

//------------------------------------------------------------------------------

function InitializeSetup(): Boolean;
begin
  Result := PromptUntilProgramClosedOrInstallationCanceled( ProgramRunningOnInstallMessage, False );

  if Not Result then
  begin
    MsgBox( InstallationCanceledMessage, mbInformation, MB_OK );
  end;
end;

//------------------------------------------------------------------------------

function InitializeUninstall(): Boolean;
begin
  Result := PromptUntilProgramClosedOrInstallationCanceled( ProgramRunningOnUninstallMessage, True );

  // Unload the DLL, otherwise the dll psvince is not deleted
  UnloadDLL(ExpandConstant('{app}\psvince.dll'));

  if not Result then
  begin
    MsgBox( UninstallationCanceledMessage, mbInformation, MB_OK );
  end;  
end;

////////// koniec psvince.dll //////////
teraz by som potreboval, aby premenné ProgramRunningOnInstallMessage, InstallationCanceledMessage sa naplnili textom jazykovej mutácie, ktorú si užívateľ vybral, t.j. povedzme stringom UninstallAppRunningError z slovak.isl (jazyky mám v inno scripte nadefinované). ako mám pozmeniť v kóde vyššie tú časť :???
const
  ProgramRunningOnInstallMessage = ProgramName + ' is currently running. ' + #13 + #13 + 'Please close it and then click on ''Retry'' to proceed with the installation.';
prosím o názorný príklad, lebo pascal vôbec neovládam

Řešení dotazu:


Nástroje: Začni sledovat (1) ?Zašle upozornění na váš email při vložení nového komentáře.

Odpovědi

12.8.2011 18:44 adrinko | skóre: 22
Rozbalit Rozbalit vše Re: inno pascal iss
Odpovědět | | Sbalit | Link | Blokovat | Admin
mám to!

Result := PromptUntilProgramClosedOrInstallationCanceled( FmtMessage(SetupMessage(msgSetupAppRunningError), ['YourAppName']), False );

Pre CustomMessages: [CustomMessages] ProgramRunningOnInstallMessage = %1 is currently running.%nPlease close it and then click on 'Retry' to proceed with the installation.

a v kóde: Result := PromptUntilProgramClosedOrInstallationCanceled(FmtMessage(CustomMessage('ProgramRunningOnInstallMessage'), ['YourAppName']), False );

skunkOS avatar 12.8.2011 20:09 skunkOS | skóre: 27 | blog: Tak nějak
Rozbalit Rozbalit vše Re: inno pascal iss
PromptUntilProgramClosedOrInstallationCanceled

takhle dlouhý název funkce ---> taková sviňárna se jen tak nevidí :)
http://martinrotter.github.io
14.8.2011 08:46 phr | skóre: 13 | blog: no_comment | Klatovy
Rozbalit Rozbalit vše Re: inno pascal iss
Ale zase není třeba psát komentář.
"Umělá inteligence se nemůže rovnat přirozený blbosti"
skunkOS avatar 15.8.2011 10:33 skunkOS | skóre: 27 | blog: Tak nějak
Rozbalit Rozbalit vše Re: inno pascal iss
:D:D
http://martinrotter.github.io
15.8.2011 12:09 adrinko | skóre: 22
Rozbalit Rozbalit vše Re: inno pascal iss
vďaka za podnetné komentáre...
16.8.2011 09:03 VM
Rozbalit Rozbalit vše Re: inno pascal iss
Odpovědět | | Sbalit | Link | Blokovat | Admin
Já chci taky programovat ISS (http://en.wikipedia.org/wiki/ISS), ale už je nahoře :-)

Založit nové vláknoNahoru

Tiskni Sdílej: Linkuj Jaggni to Vybrali.sme.sk Google Del.icio.us Facebook

ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.