FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   FMXInno - Windows Fluent Design Installer UI for Inno (https://fileforums.com/showthread.php?t=104852)

Masquerade 06-10-2023 02:37

I'm getting so far, but I think I've hit a roadblock. When compiling, the following line of code hits an error with invalid number of parameters. I have determined this to be "PreviousFileCount: Integer;" but please may somebody explain what this means? I will try to fix that.

Code:

VerifyHashesFromFile(ExpandConstant('{app}\_Verify\kaos.blake3'), ExpandConstant('{app}\_Verify'), 11, False, @VerifyHashMultiCallback);
Code:

function VerifyHashesFromFile(ChecksumFile, BasePath: WideString; HashAlgo, PreviousFileCount: Integer; LogFile: Boolean; Callback: TMultiHashCallback): Integer;
There is also an error compiling the function

MinimizeWindowCustomAnimated(FMXForm.HandleHWND, 50, 50, 40, 15);

As the new function only takes 2 parameters.

hitman797 06-10-2023 03:41

Quote:

Originally Posted by Masquerade (Post 502726)
I'm getting so far, but I think I've hit a roadblock. When compiling, the following line of code hits an error with invalid number of parameters. I have determined this to be "PreviousFileCount: Integer;" but please may somebody explain what this means? I will try to fix that.

Code:

VerifyHashesFromFile(ExpandConstant('{app}\_Verify\kaos.blake3'), ExpandConstant('{app}\_Verify'), 11, False, @VerifyHashMultiCallback);
Code:

function VerifyHashesFromFile(ChecksumFile, BasePath: WideString; HashAlgo, PreviousFileCount: Integer; LogFile: Boolean; Callback: TMultiHashCallback): Integer;

Code:

VerifyHashesFromFile(ExpandConstant('{app}\_Verify\kaos.blake3'), ExpandConstant('{app}\_Verify'), 11,  0,False, @VerifyHashMultiCallback);
Code:

function VerifyHashesFromFile(ChecksumFile, BasePath: WideString; HashAlgo, PreviousFileCount: Integer; LogFile: Boolean; Callback: TMultiHashCallback): Integer;
Quote:

Originally Posted by Masquerade (Post 502726)
There is also an error compiling the function

MinimizeWindowCustomAnimated(FMXForm.HandleHWND, 50, 50, 40, 15);

As the new function only takes 2 parameters.

Code:

type
TMinimizeAnimPos    = (mapTop, mapBottom, mapLeft, mapRight);

function MinimizeWindowCustomAnimated(MinimizeAnimPos: TMinimizeAnimPos): Boolean;
  external 'MinimizeWindowCustomAnimated@files:FMXInno.dll stdcall delayload';
procedure pMinimizeWindow(const WinHandle: Cardinal);
  external 'pMinimizeWindow@files:FMXInno.dll stdcall delayload';

Code:

MinimizeWindowCustomAnimated(mapTop);
MinimizeWindow(WizardForm.Handle);


Cesar82 06-10-2023 03:45

Quote:

Originally Posted by Masquerade (Post 502726)
I'm getting so far, but I think I've hit a roadblock. When compiling, the following line of code hits an error with invalid number of parameters. I have determined this to be "PreviousFileCount: Integer;" but please may somebody explain what this means? I will try to fix that.

Code:

VerifyHashesFromFile(ExpandConstant('{app}\_Verify\kaos.blake3'), ExpandConstant('{app}\_Verify'), 11, False, @VerifyHashMultiCallback);
Code:

function VerifyHashesFromFile(ChecksumFile, BasePath: WideString; HashAlgo, PreviousFileCount: Integer; LogFile: Boolean; Callback: TMultiHashCallback): Integer;
There is also an error compiling the function

MinimizeWindowCustomAnimated(FMXForm.HandleHWND, 50, 50, 40, 15);

As the new function only takes 2 parameters.

PreviousFileCount is the initial value that must be added to the count of items displayed in calback if you call the function more than once.
Using this parameter, the total number of files will be displayed correctly when entering the value from the previous call.
Code:

VerifyHashesFromFile(ExpandConstant('{app}\_Verify\kaos.blake3'), ExpandConstant('{app}\_Verify'), 11, 0, False, @VerifyHashMultiCallback);

Masquerade 06-10-2023 06:37

Sorry to keep asking, but now I've got a Type Mismatch for the following lines:

<button>.OnMouseDown(@CommonButtonDown);
<button>.OnMouseUp(@CommonButtonUp);

It seems that OnMouseDown/OnMouseUp are both TMouseEventF whereas CommonButtonDown/Up is a procedure. Is this the cause of the error?

Apologies for asking so much! :o

hitman797 06-10-2023 07:06

Quote:

Originally Posted by Masquerade (Post 502733)
Sorry to keep asking, but now I've got a Type Mismatch for the following lines:

<button>.OnMouseDown(@CommonButtonDown);
<button>.OnMouseUp(@CommonButtonUp);

It seems that OnMouseDown/OnMouseUp are both TMouseEventF whereas CommonButtonDown/Up is a procedure. Is this the cause of the error?

Apologies for asking so much! :o

copy the procedure.
Code:

procedure OnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
begin
//
end;

procedure OnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
begin
//
end;

Code:

TMouseEventF        = procedure(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
TMouseMoveEventF    = procedure(Sender: TObject; Shift: TShiftState; X, Y: Single);
TKeyEventF          = procedure(Sender: TObject; var Key: Word; var KeyChar: WideChar; Shift: TShiftState);


hitman797 06-10-2023 07:22

2 Attachment(s)
hi, @BLACKFIRE69 can you add this class to the FMXInno.
this class is VCL component in unite VCL.FileCtrl.
I use unite FMX.Platform.Win to Handle the VCL component in FMX Form.
I made example in delphi.
THANK YOU.
Win 3.1:
Code:

  hDrive: TDriveComboBox;
  hFilter: TFilterComboBox;
  hDirectory: TDirectoryListBox;
  hFileList: TFileListBox;

ListBox:
Code:

procedure ListBoxItemClick(const Sender: TCustomListBox;
  const Item: TListBoxItem);
begin
end;

Label:
Code:

  GetText

BLACKFIRE69 06-10-2023 15:16

Quote:

Originally Posted by audiofeel (Post 502703)
Preliminarily... failure at startup occurs only if the script is built on version 5.6.1. On version 6.2.2, I have not noticed any failures yet. I could be wrong . It is possible that something is wrong with my pc machine. Or I have a mistake in the script.
youtu.be



sorry for the delayed response; i've been quite busy these past few days and, to be honest, i haven't had a good night's sleep in two days. :o


it seems that the wGetLogicalDriveList function doesn't function as expected in InnoSetup v5.x. however, the FLogicalDrives class works reliably across all scenarios and has undergone thorough testing.


Code:

type
  FLogicalDrives = interface(IUnknown)
    '{73D9B3A3-6571-474E-B043-7DC8D3248538}'
    procedure FCreate;
    function Count: Integer;
    function CDriveIndex: Integer;
    function Letter(const Index: Integer): WideString;
    function LetterToIndex(const Letter: WideString): Integer;
    function IsRemovable(const Index: Integer): Boolean;
    function MediaType(const Index: Integer): Integer;
    function MediaTypeEx(const Index: Integer; out HealthStatus, Usage: Integer): Integer;
    function SpaceFreeMB(const Index: Integer): Integer;
    function SpaceAvailableMB(const Index: Integer): Integer;
    function SpaceTotalMB(const Index: Integer): Integer;
  end;


Code:

{ Drive Media Type }
const
  HDD_MEDIA_TYPE_UNKNOWN        = $0000;
  HDD_MEDIA_TYPE_USB            = $0001;
  HDD_MEDIA_TYPE_SD            = $0002;
  HDD_MEDIA_TYPE_HDD            = $0003;
  HDD_MEDIA_TYPE_SSD            = $0004;
  HDD_MEDIA_TYPE_SCM            = $0005;
  HDD_MEDIA_TYPE_NVMe          = $0006;

{ Drive Health }
const
  HDD_HEALTH_STATUS_HEALTHY    = $0000;
  HDD_HEALTH_STATUS_WARNING    = $0001;
  HDD_HEALTH_STATUS_UNHEALTHY  = $0002;
  HDD_HEALTH_STATUS_UNKNOWN    = $0005;

{ Drive Usage }
const
  HDD_USAGE_UNKWOWN            = $0000;
  HDD_USAGE_AUTO_SELECT        = $0001; // used for data storage.
  HDD_USAGE_MANUAL_SELECT      = $0002; // used if manually selected by an administrator at the time of virtual disk creation.
  HDD_USAGE_RETIRED            = $0004; // retired from use
  HDD_USAGE_CACHE              = $0005; // used as a cache for other devices.


Code:

  { LogicalDrives }
  LogicalDrives.FCreate;

  if LogicalDrives.Count > 0 then
  begin
    { ListBox }
    ListBox.FCreate(FMXForm.Handle);
    ListBox.SetBounds(NSX(32), NSY(53), NSX(297), NSY(249));
    ListBox.OnChange(@ListBoxOnChange);

    if ImgList.Count >= 2 then
      ListBox.ImageList(ImgList.Handle);

    { ListBox-Items }
    SetArrayLength(ListBoxItems, LogicalDrives.Count);

    ListBox.BeginUpdate;  // BeginUpdate
    for i := 0 to LogicalDrives.Count - 1 do
    begin
      ListBoxItems[i] := InitListBoxItemHandle;
      ListBoxItems[i].FCreate(ListBox.Handle);
      ListBoxItems[i].Text(LogicalDrives.Letter(i));

      if (ImgList.Count >= 2) then
      begin
        if (i = LogicalDrives.CDriveIndex) then  // C-Drive
          ListBoxItems[i].ImageIndex(0)
        else
          ListBoxItems[i].ImageIndex(1);
      end;

      ListBox.AddItem(ListBoxItems[i].Handle);
    end;
    ListBox.EndUpdate;    // EndUpdate
  end else
    MsgBox('"LogicalDrives" failded!', mbError, MB_OK);


.

hitman797 07-10-2023 03:05

2 Attachment(s)
System.SysUtils and System.IOUtils Unite:
Code:

procedure TForm8.Button1Click(Sender: TObject);
var
  i: Integer;
  hFileName: String;
  hDirArray, hFileArray: TStringDynArray;
begin
  ListBox1.Items.Clear;
  ListBox1.BeginUpdate;
  hFileName := 'C:\Windows';
  ListBox1.Items.Add(ExtractFileName(hFileName));
  hDirArray := TDirectory.GetDirectories(hFileName);
  for hFileName in hDirArray do
  begin
    ListBox1.Items.Add(ExtractFileName(hFileName));
  end;
{  hFileArray := TDirectory.GetFiles(hFileName);
  for hFileName in hFileArray do
  begin
    ListBox1.Items.Add(ExtractFileName(hFileName));
  end;  }
  ListBox1.EndUpdate;
end;


hitman797 07-10-2023 05:52

2 Attachment(s)
Code:

procedure TDialogForm.Button1Click(Sender: TObject);
begin
  if length(Label1.Text) = 3 then
  begin
    CreateDir(Label1.Text+Edit1.Text);
    Label1.Text:= Label1.Text+Edit1.Text;
  end else begin
    CreateDir(Label1.Text+'\'+Edit1.Text);
    Label1.Text:= Label1.Text+'\'+Edit1.Text;
  end;
  Timer1.Enabled:= True;
end;

procedure TDialogForm.FormCreate(Sender: TObject);
var
 hDriveArry: TStringDynArray;
 hDriveName: String;
begin
  ListBox1.Clear;
  ListBox1.BeginUpdate;
  hDriveArry:= TDirectory.GetLogicalDrives;
  for hDriveName in hDriveArry do
  begin
  ListBox1.Items.Add(hDriveName);
  end;
  ListBox1.EndUpdate;
  Timer1.Enabled:= True;
end;

procedure TDialogForm.ListBox1ItemClick(const Sender: TCustomListBox;
  const Item: TListBoxItem);
begin
  Label1.Text:= ListBox1.Items.Strings[ListBox1.ItemIndex];
  Timer1.Enabled:= True;
end;

procedure TDialogForm.ListBox2ItemClick(const Sender: TCustomListBox;
  const Item: TListBoxItem);
begin
  if length(Label1.Text) = 3 then
  begin
    Label1.Text:= Label1.text+ListBox2.Items.Strings[ListBox2.ItemIndex];
  end else begin
    Label1.Text:= Label1.text+'\'+ListBox2.Items.Strings[ListBox2.ItemIndex];
  end;
  Timer1.Enabled:= True;
end;

procedure TDialogForm.SpeedButton1Click(Sender: TObject);
begin
  Label1.Text:= 'C:\Windows';
  Timer1.Enabled:= True;
end;

procedure TDialogForm.SpeedButton2Click(Sender: TObject);
begin
  Label1.Text:= ExtractFileDir(Label1.Text);
  Timer1.Enabled:= True;
end;

procedure TDialogForm.Timer1Timer(Sender: TObject);
var
 hDirArry: TStringDynArray;
 hDirName: String;
begin
  ListBox2.Clear;
  ListBox2.BeginUpdate;
  hDirName:= Label1.Text;
  hDirArry:= TDirectory.GetDirectories(hDirName);
  for hDirName in hDirArry do
  begin
    ListBox2.Items.Add(ExtractFileName(hDirName));
  end;
  ListBox2.EndUpdate;
  Timer1.Enabled:= False;
end;


BLACKFIRE69 07-10-2023 08:29

Testing
 
Testing:

guys, if any of you happen to have some free time and are using virtual machines other than VMware 17.x, could you please test this on them?





https://i.ibb.co/GtSV1rL/01.png





Quote:

Originally Posted by BLACKFIRE69 (Post 502738)
sorry for the delayed response; i've been quite busy these past few days and, to be honest, i haven't had a good night's sleep in two days. :o


it seems that the wGetLogicalDriveList function doesn't function as expected in InnoSetup v5.x. however, the FLogicalDrives class works reliably across all scenarios and has undergone thorough testing.


Code:

type
  FLogicalDrives = interface(IUnknown)
    '{73D9B3A3-6571-474E-B043-7DC8D3248538}'
    procedure FCreate;
    function Count: Integer;
    function CDriveIndex: Integer;
    function Letter(const Index: Integer): WideString;
    function LetterToIndex(const Letter: WideString): Integer;
    function IsRemovable(const Index: Integer): Boolean;
    function MediaType(const Index: Integer): Integer;
    function MediaTypeEx(const Index: Integer; out HealthStatus, Usage: Integer): Integer;
    function SpaceFreeMB(const Index: Integer): Integer;
    function SpaceAvailableMB(const Index: Integer): Integer;
    function SpaceTotalMB(const Index: Integer): Integer;
  end;


Code:

{ Drive Media Type }
const
  HDD_MEDIA_TYPE_UNKNOWN        = $0000;
  HDD_MEDIA_TYPE_USB            = $0001;
  HDD_MEDIA_TYPE_SD            = $0002;
  HDD_MEDIA_TYPE_HDD            = $0003;
  HDD_MEDIA_TYPE_SSD            = $0004;
  HDD_MEDIA_TYPE_SCM            = $0005;
  HDD_MEDIA_TYPE_NVMe          = $0006;

{ Drive Health }
const
  HDD_HEALTH_STATUS_HEALTHY    = $0000;
  HDD_HEALTH_STATUS_WARNING    = $0001;
  HDD_HEALTH_STATUS_UNHEALTHY  = $0002;
  HDD_HEALTH_STATUS_UNKNOWN    = $0005;

{ Drive Usage }
const
  HDD_USAGE_UNKWOWN            = $0000;
  HDD_USAGE_AUTO_SELECT        = $0001; // used for data storage.
  HDD_USAGE_MANUAL_SELECT      = $0002; // used if manually selected by an administrator at the time of virtual disk creation.
  HDD_USAGE_RETIRED            = $0004; // retired from use
  HDD_USAGE_CACHE              = $0005; // used as a cache for other devices.


Code:

  { LogicalDrives }
  LogicalDrives.FCreate;

  if LogicalDrives.Count > 0 then
  begin
    { ListBox }
    ListBox.FCreate(FMXForm.Handle);
    ListBox.SetBounds(NSX(32), NSY(53), NSX(297), NSY(249));
    ListBox.OnChange(@ListBoxOnChange);

    if ImgList.Count >= 2 then
      ListBox.ImageList(ImgList.Handle);

    { ListBox-Items }
    SetArrayLength(ListBoxItems, LogicalDrives.Count);

    ListBox.BeginUpdate;  // BeginUpdate
    for i := 0 to LogicalDrives.Count - 1 do
    begin
      ListBoxItems[i] := InitListBoxItemHandle;
      ListBoxItems[i].FCreate(ListBox.Handle);
      ListBoxItems[i].Text(LogicalDrives.Letter(i));

      if (ImgList.Count >= 2) then
      begin
        if (i = LogicalDrives.CDriveIndex) then  // C-Drive
          ListBoxItems[i].ImageIndex(0)
        else
          ListBoxItems[i].ImageIndex(1);
      end;

      ListBox.AddItem(ListBoxItems[i].Handle);
    end;
    ListBox.EndUpdate;    // EndUpdate
  end else
    MsgBox('"LogicalDrives" failded!', mbError, MB_OK);


.


hitman797 08-10-2023 01:03

Quote:

Originally Posted by audiofeel (Post 502754)
I don't quite understand what the timer is for? :rolleyes:

A timer is set to update the listbox when we change the path in the label.

BLACKFIRE69 08-10-2023 12:45

FMXInno - Updates
 
FMXInno - Updates

Code:

FMXInno - Changes

1. Added new classes:
  - FTreeView
  - FTreeViewItem
  - FMenuBar
  - FMenuBarItem

2. FCheckboxTree - Removed the following properties:
  - procedure Selectable(FEnable: Boolean)
  - procedure RemoveBckgnd

3. Added some new functions.

4. Some improvements:
  - TitleBar
  - FForm

5. Bug Fixing.


TreeView + MainMenu:


Code:

{ MainMenu }
  PMenuBar.FCreate(FMXForm.Handle);
  PMenuBar.ImageList(ImgList.Handle);

  { Home }
  pMenuItem[1].FCreate(PMenuBar.Handle);
  pMenuItem[1].Text('Home');
  pMenuItem[1].ImageIndex(0);
  PMenuBar.AddItem(pMenuItem[1].Handle);

  pMenuItem[2].FCreate(pMenuItem[1].Handle);
  pMenuItem[2].Text('Open');
  pMenuItem[2].ShortCut(wGetShortCut(vkO, [ssCtrl]));
  pMenuItem[2].ImageIndex(1);
  pMenuItem[2].OnClick(@CommonOnClick);
  pMenuItem[1].AddItem(pMenuItem[2].Handle);

  ...
{ MainMenu }


Code:

{ TreeView 1 - Left }
  kTreeView.FCreate(FMXForm.Handle);
  kTreeView.SetBounds(NSX(40), NSY(120), NSX(249), NSY(329));
  kTreeView.ImageList(ImgList.Handle);

  kTreeViewItem[1].FCreate(kTreeView.Handle);    // User
  kTreeViewItem[1].ImageIndex(20);
  kTreeViewItem[1].Text(GetUserNameString);
  kTreeViewItem[1].Margins(NSX(-20),0,0,0);
  kTreeView.AddItem(kTreeViewItem[1].Handle);

  kTreeViewItem[2].FCreate(kTreeView.Handle);    // Desktop
  kTreeViewItem[2].ImageIndex(21);
  kTreeViewItem[2].Text('Desktop');
  kTreeViewItem[2].Margins(NSX(-20),0,0,0);
  kTreeView.AddItem(kTreeViewItem[2].Handle);

  ...
{ TreeView 1 - Left }


Code:

{ TreeView 2 - Right }
  mTreeView.FCreate(FMXForm.Handle);
  mTreeView.SetBounds(NSX(340), NSY(120), NSX(249), NSY(329));
  mTreeView.ShowCheckboxes(True);

  mTreeViewItem[1].FCreate(mTreeView.Handle);
  mTreeViewItem[1].StyledSettings([]);
  mTreeViewItem[1].FontSettings('Segoe UI', 12, AlRed, [fsBold, fsUnderline]);
  mTreeViewItem[1].Text('Come, Let''s Destroy Our World!');
  mTreeView.AddItem(mTreeViewItem[1].Handle);

  { Weapon Preset }
  mTreeViewItem[2].FCreate(mTreeViewItem[1].Handle);
  mTreeViewItem[2].StyledSettings([]);
  mTreeViewItem[2].FontSettings('Segoe UI', 12, AlBlue, [fsBold]);
  mTreeViewItem[2].Text('Weapon Preset');
  mTreeViewItem[1].AddItem(mTreeViewItem[2].Handle);

  mTreeViewItem[3].FCreate(mTreeViewItem[2].Handle);
  mTreeViewItem[3].Text('Soviet');
  mTreeViewItem[2].AddItem(mTreeViewItem[3].Handle);

  ...
{ TreeView 2 - Right }


.

hitman797 08-10-2023 14:07

2 Attachment(s)
Quote:

Originally Posted by BLACKFIRE69 (Post 502770)
FMXInno - Updates

Code:

FMXInno - Changes

1. Added new classes:
  - FTreeView
  - FTreeViewItem
  - FMenuBar
  - FMenuBarItem

2. FCheckboxTree - Removed the following properties:
  - procedure Selectable(FEnable: Boolean)
  - procedure RemoveBckgnd

3. Added some new functions.

4. Some improvements:
  - TitleBar
  - FForm

5. Bug Fixing.

.

Great job my friend, thank you.
Code:

procedure TDialogForm.Button1Click(Sender: TObject);
begin
  if length(Label1.Text) = 3 then
  begin
    CreateDir(Label1.Text+Edit1.Text);
    Label1.Text:= Label1.Text+Edit1.Text;
  end else begin
    CreateDir(Label1.Text+'\'+Edit1.Text);
    Label1.Text:= Label1.Text+'\'+Edit1.Text;
  end;
  Timer1.Enabled:= True;
end;

procedure TDialogForm.FormCreate(Sender: TObject);
var
 hDriveArry: TStringDynArray;
 hDriveName: String;
begin
  ListBox1.Clear;
  ListBox1.BeginUpdate;
  hDriveArry:= TDirectory.GetLogicalDrives;
  for hDriveName in hDriveArry do
  begin
  ListBox1.Items.Add(hDriveName);
  end;
  ListBox1.EndUpdate;
  Timer1.Enabled:= True;
end;

procedure TDialogForm.ListBox1ItemClick(const Sender: TCustomListBox;
  const Item: TListBoxItem);
begin
  Label1.Text:= ListBox1.Items.Strings[ListBox1.ItemIndex];
  Timer1.Enabled:= True;
end;

procedure TDialogForm.ListBox2ItemClick(const Sender: TCustomListBox;
  const Item: TListBoxItem);
begin
  if length(Label1.Text) = 3 then
  begin
    Label1.Text:= Label1.text+ListBox2.Items.Strings[ListBox2.ItemIndex];
  end else begin
    Label1.Text:= Label1.text+'\'+ListBox2.Items.Strings[ListBox2.ItemIndex];
  end;
  Timer1.Enabled:= True;
end;

procedure TDialogForm.SpeedButton1Click(Sender: TObject);
begin
  Label1.Text:= 'C:\Windows';
  Timer1.Enabled:= True;
end;

procedure TDialogForm.SpeedButton2Click(Sender: TObject);
begin
  Label1.Text:= ExtractFileDir(Label1.Text);
  Timer1.Enabled:= True;
end;

procedure TDialogForm.Timer1Timer(Sender: TObject);
var
 hDirArry: TStringDynArray;
 hDirName: String;
begin
  ListBox2.Clear;
  ListBox2.BeginUpdate;
  hDirName:= Label1.Text;
  hDirArry:= TDirectory.GetDirectories(hDirName);
  for hDirName in hDirArry do
  begin
    ListBox2.Items.Add(ExtractFileName(hDirName));
  end;
  ListBox2.EndUpdate;
  Timer1.Enabled:= False;
end;

in innosetup we have this function.
Code:

function Length(S: String): Longint;
function CreateDir(const Dir: String): Boolean;
function RemoveDir(const Dir: String): Boolean;
//
function ExtractFileExt(const FileName: String): String;
function ExtractFileDir(const FileName: String): String;
function ExtractFilePath(const FileName: String): String;
function ExtractFileName(const FileName: String): String;
function ExtractFileDrive(const FileName: String): String;
//
function GetCurrentDir: String;
function SetCurrentDir(const Dir: String): Boolean;
function GetWinDir: String;
function GetSystemDir: String;
function GetSysWow64Dir: String;
function GetTempDir: String;

but we need to add this function:
System.IOUtils:
Code:

function TDirectory.GetFiles(const Path: string): TStringDynArray;
function TDirectory.GetDirectories(const Path: string): TStringDynArray;
function TDirectory.GetLogicalDrives: TStringDynArray;
TArrayOfString = array of String; in innosetup

ListBox:
Code:

procedure ListBoxItemClick(const Sender: TCustomListBox;
  const Item: TListBoxItem);

Label:
Code:

function GetText: WideString;

BLACKFIRE69 08-10-2023 16:47

Quote:

Originally Posted by hitman797 (Post 502773)
but we need to add this function:
System.IOUtils:
Code:

function TDirectory.GetFiles(const Path: string): TStringDynArray;
function TDirectory.GetDirectories(const Path: string): TStringDynArray;
function TDirectory.GetLogicalDrives: TStringDynArray;
TArrayOfString = array of String; in innosetup

ListBox:
Code:

procedure ListBoxItemClick(const Sender: TCustomListBox;
  const Item: TListBoxItem);

Label:
Code:

function GetText: WideString;



i think you may not have noticed that FMXInno has already included these things.


Quote:

Originally Posted by hitman797 (Post 502773)
Code:

function TDirectory.GetFiles(const Path: string): TStringDynArray;

Code:

var
  FindHandle: Longint;

begin
  FindHandle := pFindFiles('C:\Test01', '*.*', '', ffrkRelative, True, False);

  if FindHandle <> 0 then
  begin
    WinTB1.Text('Files: ' + IntToStr(pFileCount(FindHandle)));

    try
      for i:=0 to pFileCount(FindHandle)-1 do
        Memo.AddLine(pPickFile(FindHandle, i));
    finally
      pFindFree(FindHandle);
    end;
  end;
end;



Quote:

Originally Posted by hitman797 (Post 502773)
Code:

function TDirectory.GetDirectories(const Path: string): TStringDynArray;

Code:

var
  FindHandle: Longint;

begin
  FindHandle := pFindFiles('C:\Test01', '*', '', ffrkRelative, True, True);

  if FindHandle <> 0 then
  begin
    WinTB1.Text('Dirs: ' + IntToStr(pDirCount(FindHandle)));

    try
      for i:=0 to pDirCount(FindHandle)-1 do
        Memo.AddLine(pPickDir(FindHandle, i));
    finally
      pFindFree(FindHandle);
    end;
  end;
end;



Quote:

Originally Posted by hitman797 (Post 502773)
Code:

function TDirectory.GetLogicalDrives: TStringDynArray;

Code:

begin
  LogicalDrives.FCreate;

  if LogicalDrives.Count > 0 then
  begin
    for i := 0 to LogicalDrives.Count - 1 do
      Memo.AddLine(LogicalDrives.Letter(i));
  end else
    MsgBox('"LogicalDrives" failded!', mbError, MB_OK);
end;



Quote:

Originally Posted by hitman797 (Post 502773)
ListBox:
Code:

procedure ListBoxItemClick(const Sender: TCustomListBox;
  const Item: TListBoxItem);


Code:

procedure ListBoxOnChange(Sender: TObject);
var
  i: integer;
  TargetLstItm: FListBoxItem;
begin
  if ListBox.GetItemIndex > -1 then
  begin
    for i := 0 to length(ListBoxItems)-1 do
      if Sender = TObject(ListBoxItems[i].GetObject) then
      begin
        TargetLstItm := ListBoxItems[i] as FListBoxItem;
        break;
      end;

    WinTB1.Text(TargetLstItm.GeText);
  end;
end;


ListBox.FCreate(FMXForm.Handle);
ListBox.SetBounds(NSX(32), NSY(53), NSX(297), NSY(249));
ListBox.OnChange(@ListBoxOnChange);


Tihiy_Don 08-10-2023 22:21

Update first post please. I also ask you to mark the version that indicates this update.


All times are GMT -7. The time now is 07:26.

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