![]() |
Doppelklick verzeichnis wechseln
Hi
mit
Delphi-Quellcode:
zeig ich die Festplatten an
procedure GetDrives(const AItems: TStrings);
const DriveTypeTexts: array[DRIVE_UNKNOWN..DRIVE_RAMDISK] of String = ('Unbekannt', 'Kein Wurzelverzeichnis', 'Diskette', 'Festplatte', 'Netzlaufwerk', 'CDROM', 'RAMDisk'); var Drive: Char; DriveType: Integer; DriveMask: Integer; Flag: Integer; begin DriveMask:=GetLogicalDrives; flag:=1; for Drive := 'A' to 'Z' do begin if (flag and DriveMask)<>0 then begin DriveType := GetDriveType(PChar(Format('%S:\',[Drive]) ) ) ; AItems.Add(Format('%s: %s', [Drive, DriveTypeTexts[DriveType]])); end; flag:=flag shl 1; end; end; und mit
Delphi-Quellcode:
zeig ich die datein an
procedure GetFilesinDirectory(Directory: String; const Mask: String;
List: TStrings; WithSubDirs, ClearList: Boolean); procedure ScanDir(const Directory: String); var SR: TSearchRec; begin if FindFirst(Directory + Mask, faAnyFile - faDirectory, SR) = 0 then try repeat List.Add(Directory + SR.Name) until FindNext(SR) <> 0; finally FindClose(SR); end; if WithSubDirs then begin if FindFirst(Directory + '*.*', faAnyFile, SR) = 0 then try repeat if (SR.Attr = faDirectory) and (SR.Name <> '.') and (SR.Name <> '..') then ScanDir(Directory + SR.Name + '\'); until FindNext(SR) <> 0; finally FindClose(SR); end; end; end; begin List.BeginUpdate; try if ClearList then List.Clear; if Directory = '' then Exit; if Directory[Length(Directory)] <> '\' then Directory := Directory + '\'; ScanDir(Directory); finally List.EndUpdate; end; end; in einer Listbox nun die Frage wenn ich einen Doppelklick auf die Festplatte C:\ mache soll in edit1 C:\ erscheinen Wie mach ich das
Delphi-Quellcode:
var
dateiname: string; begin dateiname:=listbox1.Items[listbox1.ItemIndex]; //muss der befehl hin das er die Festplatte c in edit 1 schreibt |
Re: Doppelklick verzeichnis wechseln
Herzlich willkommen in der Delphi-PRAXiS.
Meinst du das hier?
Delphi-Quellcode:
Grüße vom marabu
with ListBox1 do
Edit1.Text := Items[ItemIndex]; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:48 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz