whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

34 Visitors Online


 
...check to see if files are pending to be burned om a CD?
Autor: Dev4u.ch
Homepage: http://www.dev4u.ch
[ Print tip ]  

Tip Rating (3):  
     


var
  
Form1: TForm1;
  dir, files: Integer;

implementation

{$R *.DFM}

uses
  
registry;

function Load(Key: string): string;
var
  
Reg: TRegistry;
begin
  
Reg := TRegistry.Create;
  try
    
Reg.RootKey := HKEY_CURRENT_USER;
    Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', False);
    try
      
Result := Reg.ReadString(Key);
    except
      
Result := '';
    end;
    Reg.CloseKey;
  finally
    
Reg.Free;
  end;
end;

procedure GetAllFiles(mask: string);
var
  
search: TSearchRec;
  directory: string;
begin
  
directory := ExtractFilePath(mask);

  // find all files
  
if FindFirst(mask, $23, search) = 0 then
  begin
    repeat
      
Inc(files);
    until FindNext(search) <> 0;
  end;



  // Subdirectories/ Unterverzeichnisse
  
if FindFirst(directory + '*.*', faDirectory, search) = 0 then
  begin
    repeat
      if 
((search.Attr and faDirectory) = faDirectory) and (search.Name[1] <> '.') then
      begin
        
GetAllFiles(directory + search.Name + '\' + ExtractFileName(mask));
        Inc(dir);
      end;

    until FindNext(search) <> 0;
    FindClose(search);
  end;
end;




procedure TForm1.Button2Click(Sender: TObject);
var
  
directory: string;
  mask: string;
  location: string;
begin
  
files         := 0;
  dir           := 0;
  location      := load('CD Burning') + '\';  //Verzeichnis der temp. Daten
  
mask          := '*.*';
  directory     := location;
  Screen.Cursor := crHourGlass;
  try
    
GetAllFiles(directory + mask);
  finally
    
Screen.Cursor := crDefault;
  end;
  if files + dir <> 0 then
    
ShowMessage(IntToStr(files) + ' Files und ' + IntToStr(dir) + ' Ordner zum Brennen')
  else
    
ShowMessage('Keine Datem zum Brennen vorhanden');
end;


 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners