View Single Post
  #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)