amebius
Newbie | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору
Код: ; Скрипт создан через Мастер Inno Setup Script. ; ИСПОЛЬЗУЙТЕ ДОКУМЕНТАЦИЮ ДЛЯ ПОДРОБНОСТЕЙ ИСПОЛЬЗОВАНИЯ INNO SETUP! #define MyAppName "My Program" #define MyAppVersion "1.5" #define MyAppPublisher "My Company, Inc." #define MyAppURL "http://www.example.com/" #define MyAppExeName "MyProg.exe" [Setup] ; Примечание: Значение AppId идентифицирует это приложение. ; Не используйте одно и тоже значение в разных установках. ; (Для генерации значения GUID, нажмите Инструменты | Генерация GUID.) AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={pf}\{#MyAppName} DefaultGroupName={#MyAppName} OutputBaseFilename=setup Compression=lzma SolidCompression=yes [Languages] Name: "default"; MessagesFile: "compiler:Default.isl" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion ; Примечание: Не используйте "Flags: ignoreversion" для системных файлов [Icons] Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon [Run] Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent [code] #define A = (Defined UNICODE) ? "W" : "A" const DRIVE_REMOVABLE = 2; DRIVE_FIXED = 3; DRIVE_REMOTE = 4; DRIVE_CDROM = 5; var TreeView1: TTreeView; function GetDriveType(nDrive: string): Longint; external 'GetDriveType{#A}@kernel32.dll stdcall'; procedure NextLevel(ParentNode: TTreeNode); var sr, srChild: TFindRec; node: TTreeNode; path: string; begin node := ParentNode; path := ''; repeat path := node.Text + '\' + path; node := node.Parent; until node = nil; // Находим первую директорию if FindFirst( path + '*.*', sr ) then begin repeat if ( sr.Name <> '.' ) and ( sr.Name <> '..' ) then if ( sr.Attributes and FILE_ATTRIBUTE_DIRECTORY ) = FILE_ATTRIBUTE_DIRECTORY then begin // Добавляем найденную папку в TreeView node := TreeView1.Items.AddChild( ParentNode, sr.Name ); node.ImageIndex := 0; node.SelectedIndex := 1; // Утверждаем, что нет подкаталогов node.HasChildren := true; // Проверяем, так ли это if FindFirst( path + sr.Name + '\*.*', srChild ) then begin repeat if ( srChild.Name <> '.' ) and ( srChild.Name <> '..' ) then if ( srChild.Attributes and FILE_ATTRIBUTE_DIRECTORY ) = FILE_ATTRIBUTE_DIRECTORY then node.HasChildren := true; until FindNext(srChild) = False or node.HasChildren; end; FindClose( srChild ); end; until FindNext( sr ) = false; end else ParentNode.HasChildren := false; FindClose( sr ); end; procedure TreeView1Expanding(Sender: TObject; Node: TTreeNode; var AllowExpansion: Boolean); begin TreeView1.Items.BeginUpdate; node.DeleteChildren; NextLevel( node ); TreeView1.Items.EndUpdate; end; procedure InitializeWizard; var node: TTreeNode; DriveType: integer; i: integer; begin TreeView1 := TTreeView.Create(WizardForm); with TreeView1 do begin Parent := WizardForm.WelcomePage; Left := ScaleX(176); Top := ScaleY(168); Width := ScaleX(321); Height := ScaleY(146); Indent := 19; OnExpanding:=@TreeView1Expanding; end; TreeView1.Items.BeginUpdate; for i := 0 to 25 do begin DriveType := GetDriveType( PAnsiChar( Chr( i + 65 ) + ':\' ) ); if DriveType = 1 then continue; node := TreeView1.Items.AddChild( nil, Chr( i+65 ) + ':' ); node.SelectedIndex := node.ImageIndex; node.HasChildren := true; end; // Обновляем TreeView TreeView1.Items.EndUpdate; |
| Всего записей: 2 | Зарегистр. 31-03-2013 | Отправлено: 13:00 19-11-2016 | Исправлено: amebius, 13:24 19-11-2016 |
|