Mega Code Archive

 
Categories / Delphi / Files
 

Detect changings of a directory

Title: Detect changings of a directory Use FindFirstChangeNotification function for detecting of changing (creating/removing) directory. procedure TForm1.Timer1Timer(Sender: TObject); var Dir: string; begin Dir:=Edit1.Text; if FindFirstChangeNotification( PChar(Dir), False, FILE_NOTIFY_CHANGE_DIR_NAME)&lt&gtINVALID_HANDLE_VALUE then Label1.Caption:=Dir+' directory presents' else Label1.Caption:=Dir+' directory absents'; end;