Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 27-09-2015, 21:23
JRD!'s Avatar
JRD! JRD! is offline
Registered User
 
Join Date: Sep 2015
Location: Matrix
Posts: 274
Thanks: 225
Thanked 600 Times in 168 Posts
JRD! is on a distinguished road
[HELP] List folders name | Inno Setup

I would like listed all folders contained in a directory.

I can only found the first folder name with this function:

Code:
[Setup]
AppName=Sample
AppVersion=1.0
DefaultDirName={pf}\Sample
DisableWelcomePage=true

[#Code]
function TryGetFirstSubfolder(const Path: string; out Folder: string): Boolean;
var
  S: string;
  FindRec: TFindRec;
begin
  Result := False;
  if FindFirst(ExpandConstant(AddBackslash(Path) + '*'), FindRec) then
  try
    repeat
      if (FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0) and
        (FindRec.Name <> '.') and (FindRec.Name <> '..') then
      begin
        Result := True;
        Folder := FindRec.Name;
        Exit;
      end;
    until
      not FindNext(FindRec);
  finally
    FindClose(FindRec);
  end;
end;

procedure InitializeWizard;
var
  CustomPage: TWizardPage;
  FileListBox: TNewListBox;
  S: string;
begin
  CustomPage := CreateCustomPage(wpWelcome, 'TryGetFirstSubfolder', 'Show the first folder name of C:');
  FileListBox := TNewListBox.Create(WizardForm);
  FileListBox.Parent := CustomPage.Surface;
  FileListBox.Align := alClient;
if TryGetFirstSubfolder('C:\', S) then FileListBox.Items.Add(S)
end;
How i could list all folders ?

Thank you.
Reply With Quote
Sponsored Links
  #2  
Old 28-09-2015, 06:58
peterf1999's Avatar
peterf1999 peterf1999 is offline
Die Hard Member
 
Join Date: Nov 2008
Location: Italy
Posts: 928
Thanks: 14
Thanked 983 Times in 236 Posts
peterf1999 is on a distinguished road
Code:
[Setup]
AppName=Sample
AppVersion=1.0
DefaultDirName={pf}\Sample
DisableWelcomePage=true

[*Code]

procedure TryGetFirstSubfolder(const Path: string; var FList: TNewListBox);
var
  S: string;
  FindRec: TFindRec;
 
begin
   if FindFirst(AddBackslash(Path) + '*', FindRec) then
  try
    repeat
      if (FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0) and
        (FindRec.Name <> '.') and (FindRec.Name <> '..') then
      begin
        FList.Items.Add(FindRec.Name);
      end;
    until
      not FindNext(FindRec);
  finally
    FindClose(FindRec);
  end;
end;

procedure InitializeWizard;
var
  CustomPage: TWizardPage;
  FileListBox: TNewListBox;
 
begin
  CustomPage := CreateCustomPage(wpWelcome, 'TryGetFirstSubfolder', 'Show the first folder name of C:');
  FileListBox := TNewListBox.Create(WizardForm);
  FileListBox.Parent := CustomPage.Surface;
  FileListBox.Align := alClient;
  TryGetFirstSubfolder('C:', FileListBox);
end;
Reply With Quote
The Following 3 Users Say Thank You to peterf1999 For This Useful Post:
Bilawal (28-09-2015), Grumpy (29-09-2015), JRD! (28-09-2015)
  #3  
Old 28-09-2015, 07:37
JRD!'s Avatar
JRD! JRD! is offline
Registered User
 
Join Date: Sep 2015
Location: Matrix
Posts: 274
Thanks: 225
Thanked 600 Times in 168 Posts
JRD! is on a distinguished road
Thanks peterf1999 !
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BlackBox v2 y_thelastknight Conversion Tutorials 567 11-03-2025 07:16
INNO TROUBLESHOOT - Tutorials and Answers about INNO Setup REV0 Conversion Tutorials 129 21-05-2021 05:51
Useful Dll for Inno Setup users peterf1999 Conversion Tutorials 88 01-12-2017 16:00
INNO TUTORIAL - Using Unicode and ANSI Versions of INNO Setup REV0 Conversion Tutorials 51 26-03-2015 06:57
provide a list of all inno setup installer script rxlord PC Games - CD/DVD Conversions 11 13-02-2014 07:09



All times are GMT -7. The time now is 01:09.


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