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;