Code snippet ...
|
procedure TForm1.Button1Click(Sender: TObject);
var
FileChangeHandle : THandle;
subFolders: longbool;
begin
//subFolders := true;
//the above works in D2 only ...
//(otherwise integer(subFolders) == -1)
//subFolders := longbool(1);
//the above works in D2 & D3 only ...
//(otherwise integer(subFolders) == -1)
//Delphi 2 to 7 ...
cardinal(subFolders) := 1;
FileChangeHandle :=
FindFirstChangeNotification('c:\', subFolders,
FILE_NOTIFY_CHANGE_FILE_NAME);
if (FileChangeHandle = INVALID_HANDLE_VALUE) then
self.caption := 'Bummer :-('
else
begin
FindCloseChangeNotification(FileChangeHandle);
self.caption := 'It worked!';
end;
end;
|
|
|
|