FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   INNO TROUBLESHOOT - Questions Here (https://fileforums.com/showthread.php?t=93193)

Cesar82 18-05-2023 06:51

Quote:

Originally Posted by shazzla (Post 501135)
Hi all !

How can i get the installed app's path to 'DefaultDirName' ?

I have a reg-entry :
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\ Windows\CurrentVersion\Uninstall\MyApp]
"InstallLocation"="D:\\MyProgram"

Theoretically in InnoSetup's [setup] section

DefaultDirName={reg:HKLM64\HKEY_LOCAL_MACHINE\SOFT WARE\Microsoft\Windows\CurrentVersion\Uninstall\My App, InstallLocation}

should do the job. But no... Any idea ?

Note : (there are "spaces" in the example paths,etc. Its only visible here,dont know why. I my script they doesnt exists. No matter.)

Try
Code:

DefaultDirName={reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\My App_is1,InstallLocation|{pf}\My App}
UsePreviousAppDir=no

The value {pf}\My App is default dir if not found value in windows registry.

shazzla 18-05-2023 21:13

Thank you very much!
I will try and report back ASAP !

Its working fine !
Thanks ! :)

Junior53 07-06-2023 17:44

Quote:

Originally Posted by BLACKFIRE69 (Post 500980)
does anyone know how to convert this following Delphi code into InnoSetup?
alternatively, if you have any other suggestions on how to accomplish this in a similar manner, please feel free to share your thoughts. thanks.

Code:

uses
  Winapi.Windows, System.SysUtils;

type
  TFuncX = procedure(const Var1: Integer); cdecl;
  TFuncY = function(const Count: Longint; var Str: AnsiString): Integer; cdecl;
  TFuncZ = procedure(const Str1, Str2: WideString); cdecl;
  TFuncCommon = record
    case Integer of
      0: (FuncX: TFuncX);
      1: (FuncY: TFuncY);
      2: (FuncZ: TFuncZ);
  end;

function MySafeLoadLibFunc(const LibName, FuncName: WideString;
  var Func: TFuncCommon; var ErrorStr: WideString): Cardinal;
begin
  ErrorStr := '';
  Result := LoadLibraryW(PWideChar(LibName));
  if Result > 32 then begin
    try
      case Integer(Func) of  // Get the address of the function by name
        0: Func.FuncX := GetProcAddress(Result, PWideChar(FuncName));
        1: Func.FuncY := GetProcAddress(Result, PWideChar(FuncName));
        2: Func.FuncZ := GetProcAddress(Result, PWideChar(FuncName));
      end;
      if not Assigned(Pointer(Integer(Func))) then begin
        ErrorStr := 'Could not find function "' + FuncName + '" in library "' + LibName + '"';
        Result := 0;
      end;
    except
      on E: Exception do begin
        ErrorStr := 'Error loading function "' + FuncName + '" from library "' + LibName + '": ' + E.Message;
        Result := 0;
      end;
    end;
  end else ErrorStr := 'Could not load library "' + LibName + '"';

  if ErrorStr = '' then ErrorStr := 'empty';
end;

Code:

USAGE:

procedure Test;
var
  MyFunc: TFuncCommon;
  ErrorStr: WideString;
  LibModule: Cardinal;
  TmpStr: AnsiString;
begin
  try
    LibModule := MySafeLoadLibFunc('MyDll.dll', 'MyFunc3', MyFunc, ErrorStr);
    if LibModule > 32 then
    begin
      //MyFunc.FuncX(69);                // Call function FuncX
      //MyFunc.FuncY(47, TmpStr);        // Call function FuncY
      MyFunc.FuncZ('Hello', 'World');  // Call function FuncZ

      FreeLibrary(LibModule); // Free MyDll.dll
    end
    else WriteLn(ErrorStr);
  except
    on E: Exception do WriteLn(E.ClassName, ': ', E.Message);
  end;
end;



Code:

MyDll:

library MyDll;

uses
  System.SysUtils, Winapi.Windows;

{$R *.res}

function ShowMsg(const Msg: WideString; Caption: WideString = 'A Msg From MyDll.dll'): Integer; cdecl;
begin
  Result := MessageBoxW(0, PWideChar(Msg), PWideChar(Caption), MB_OK);
end;

procedure MyFunc1(const Var1: Integer); cdecl;
begin
  ShowMsg('[MyFunc1] : Var1  =  ' + IntToStr(Var1));
end;

function MyFunc2(const Count: Longint; var Str: AnsiString): Integer; cdecl;
begin
  Str := 'BLACKFIRE';
  Result := -10;
  ShowMsg('[MyFunc2] : Count  =  ' + IntToStr(Count));
end;

procedure MyFunc3(const Str1, Str2: WideString); cdecl;
begin
  ShowMsg('[MyFunc3] : Str1  =  ' + Str1 + ',  Str2  =  ' + Str2);
end;

exports MyFunc1, MyFunc2, MyFunc3;

begin
end.


I recommend you to use ChatGPT or Bing Ai for this!

Masquerade 08-06-2023 00:32

Quote:

Originally Posted by Junior53 (Post 501291)
I recommend you to use ChatGPT or Bing Ai for this!

ChatGPT is notoriously bad at writing complicated code. Sure, it can write simple algorithms, I use it sometimes to write quick scripts for making my repacks, but anything beyond this it usually gets the syntax wrong or the program will not work.

Junior53 08-06-2023 03:03

Quote:

Originally Posted by Masquerade (Post 501294)
ChatGPT is notoriously bad at writing complicated code. Sure, it can write simple algorithms, I use it sometimes to write quick scripts for making my repacks, but anything beyond this it usually gets the syntax wrong or the program will not work.

Actually, I told him to use it because he can get an simple idea of ​​how to do this.

Junior53 23-06-2023 09:14

Question's
 
01.how to show Component Page before the Select Dir Page (without creating custom forms or anything like that) in Inno setup 5.5.1 ee2 version?

02.how to calculate the required disk space based on the components selected and show in gigabyte on Component page in Inno setup 5.5.1 ee2 version?

I actually found an answer to this. But it doesn't work. If someone gives an answer to these two, it will be a great help <3

Code:

var
  Component1Size: Extended;
  Component2Size: Extended;
  // Add variables for each component as needed

procedure InitializeWizard;
begin
  Component1Size := 1048576;
  Component2Size := 2097152;
  // Assign sizes for other components if needed
end;

function GetTotalSize: String;
var
  TotalSize: Extended;
begin
  TotalSize := 0;
  if WizardForm.ComponentsList.Checked[0] then
    TotalSize := TotalSize + Component1Size;
  if WizardForm.ComponentsList.Checked[1] then
    TotalSize := TotalSize + Component2Size;
  // Add similar lines for other components if needed

  Result := FormatFloat('#,##0.00', TotalSize / 1024 / 1024 / 1024); // Convert bytes to gigabytes
end;

procedure ComponentsPageOnNextButtonClick(Sender: TWizardPage; var Continue: Boolean);
begin
  if Sender.ID = wpSelectComponents then
    WizardForm.DiskSpaceLabel.Caption := 'Required disk space: ' + GetTotalSize + ' GB';
end;


-tara 15-07-2023 07:19

Hello everybody,
I'm using IsArcEx for FreeArc archive decompression and I am attempting to apply a hdiffz patch after install, here is how I'm doing so:

Code:

procedure patching;
var
  ResultCode: Integer;
begin
      Exec(ExpandConstant('{tmp}\hpatchz.exe'), (ExpandConstant('{app}\...\file.one {app}\...\file.two {app}\...\file.three')), (ExpandConstant('{app}')), SW_SHOW, ewWaitUntilTerminated, ResultCode)
   
      DeleteFile (ExpandConstant('{app}\...\file.one'));
      DeleteFile (ExpandConstant('{app}\...\file.two'));
end;

Where patching is refrenced:
Code:

    if (ISArcDiskAddingSuccess) and ISArcExInit(MainForm.Handle, {#TimeFormat}, @ProgressCallback) then
    begin
      repeat
        if ISArcExDiskCount = 0 then begin
          MsgBox('There is no any archive found for unpacking.', mbError, MB_OK);
          break;
        end;

        ChangeLanguage('English');
        //ChangeLanguage('Russian');

        for i := 1 to ISArcExDiskCount do begin
          ISArcExError := not ISArcExExtract(i, ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}'));
          if ISArcExError then break;
        end;
      until true;
      patching();
      ISArcExStop;

      if ISArcExError then
        MsgBox('Installation is corrupted.', mbError, MB_OK)
    end;

    HideControls;
    WizardForm.CancelButton.Visible := true;
    WizardForm.CancelButton.Enabled := false;
  end;

However, what ends up happening is the patch does not apply and after decompression the timer immediately ends.
What I would like to happen is the timer continuing and after the patch is applied for it to end. Thanks in advance

-tara 16-07-2023 08:04

audiofeel, How would I achieve this without utilizing FMXInno.dll?

-tara 16-07-2023 13:30

Quick update.
What I was doing was using absolute paths instead of using relative ones, this lead the patch to attempt to execute but it would lead to an error.
The way I fixed it, if anyone encounters this issue in the future was to copy the necessary files to {app} and run with relative paths there.

Lord.Freddy 22-07-2023 13:09

SelectDisk
 
1 Attachment(s)
Hello everyone, I am trying to implement the function (SelectDisk) that is available in (InnoSetup) 6, so I wrote the code that is in the (zip) file below, but after execution

1: If I click on the (OK) button and if the requested file is not there, it should give me an error, but it ignores this.

2: If I click on the (cancel) button, it should show me the exit message box, but it ignores it.

I will be glad if someone can fix the problems of this code :)

Cesar82 22-07-2023 18:37

1 Attachment(s)
Quote:

Originally Posted by Lord.Freddy (Post 501671)
Hello everyone, I am trying to implement the function (SelectDisk) that is available in (InnoSetup) 6, so I wrote the code that is in the (zip) file below, but after execution

1: If I click on the (OK) button and if the requested file is not there, it should give me an error, but it ignores this.

2: If I click on the (cancel) button, it should show me the exit message box, but it ignores it.

I will be glad if someone can fix the problems of this code :)

The functions "TNewDiskForm.OnCloseQuery " or "TNewDiskForm.OnClose" are called before returning a ShowModal value.
I recommend putting OnClick procedures for the "OK" and "Cancel" buttons and putting your functions there, then you can set the values of the global variable "ModalResult".

Tmills 06-08-2023 03:29

Hey, I'm a new member and joined yesterday. I am a complete noob but have learned a lot reading through this forum in just one day. I am currently using ASIS: Advanced Simple Installer Script and want to change the background JPG slideshow to a GIF image. I have found GifLib.dll but do not know how to adjust the script code and wondered if someone with know-how can do this for me or show me what needs changing. I have no coding experience, but I learn pretty quick, I'm a visual learner.

I have put the GifLib.dll in ASIS.v7.4.4\Resources\Modules\InstallBG folder

i have found the following lines in the script that I'm assuming need changing:

#if UseInstallBackground
Source: "Resources\Modules\InstallBG\InnoCallback.dll" ; DestDir: "{tmp}"; Flags: dontcopy
Source: "Resources\Modules\InstallBG\IsSlideShow.dll"; DestDir: "{tmp}"; Flags: dontcopy
#sub AddFile2
Source: "Setup\Background\{#i}.jpg"; DestDir: "{tmp}"; Flags: dontcopy
#endsub
#for {i = 1; FileExists("Setup\Background" + Str(i) + ".jpg" ) != 0; i++} AddFile2
#endif

Any help appreciated.

Dragonis40 17-09-2023 04:05

function GetVolumeFreeSpace(const RootDir: PAnsichar; const OutSizeType: Byte): Double; external 'GetVolumeFreeSpace@files:Isab.dll stdcall delayload';

Good morning, how to extract the value from the function above?

I've tried:

value.Caption:=StrToInt(GetVolumeFreeSpace);
value.Caption:=FloatToStr(GetVolumeFreeSpace);
value.Caption:=StrToFloat(GetVolumeFreeSpace);

I have "invalid parameters" issue.

How can i fix the problem? Thanks in advance!

Lord.Freddy 17-09-2023 04:59

Quote:

Originally Posted by Dragonis40 (Post 502526)
function GetVolumeFreeSpace(const RootDir: PAnsichar; const OutSizeType: Byte): Double; external 'GetVolumeFreeSpace@files:Isab.dll stdcall delayload';

Good morning, how to extract the value from the function above?

I've tried:

value.Caption:=StrToInt(GetVolumeFreeSpace);
value.Caption:=FloatToStr(GetVolumeFreeSpace);
value.Caption:=StrToFloat(GetVolumeFreeSpace);

I have "invalid parameters" issue.

How can i fix the problem? Thanks in advance!

if you want to get free and total bytes or megabytes on a drive,
Use this function instead.

shazzla 23-09-2023 00:10

hi !

Need a little help here... I tried many combinations ,googled for it ,but no solution. (Standard ISDone)

I want to include/extract some files (XTool-BIK compressor) in my installer and extract them to a sub-folder in {tmp} but the subfolder is not created. Simply all files extracted to the same place ( {tmp} ) ,and it is not good....

Here comes a snippet :

#ifdef xBIK
Source: Include\XToolbpk\_libraries\bik.ini; DestDir: "{tmp}\xBIK\_libraries"; Flags: dontcopy recursesubdirs createallsubdirs
Source: Include\XToolbpk\_libraries\bk2.ini; DestDir: "{tmp}\xBIK\_libraries"; Flags: dontcopy recursesubdirs createallsubdirs
.......


#ifdef xBIK
ExtractTemporaryFile('bik.ini');
ExtractTemporaryFile('bk2.ini');


Whats wrong with my script ?


All times are GMT -7. The time now is 10:53.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com