Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Dateinamen herausbekommen (https://www.delphipraxis.net/49120-dateinamen-herausbekommen.html)

luckystar85 5. Jul 2005 20:32


Dateinamen herausbekommen
 
Moin,

ich habe mit

Delphi-Quellcode:
var
  dwWaitStatus : DWORD;
begin
  hNotifity := FindFirstChangeNotification(PChar(FsDirPath), true, FILE_NOTIFY_CHANGE_FILE_NAME or
                                                                   FILE_NOTIFY_CHANGE_LAST_WRITE or
                                                                   FILE_NOTIFY_CHANGE_SIZE or
                                                                   FILE_ACTION_ADDED or
                                                                   FILE_ACTION_REMOVED or
                                                                   FILE_ACTION_MODIFIED);
  if (hNotifity = INVALID_HANDLE_VALUE) then
  begin
    RaiseLastWin32Error;
    Terminate;
  end;

  while ((FindNextChangeNotification(hNotifity)) and (not terminated)) do
  begin
    Application.ProcessMessages;
    dwWaitStatus := WaitForSingleObject(hNotifity, 1000);
    if (dwWaitStatus = WAIT_FAILED) then
    begin
      RaiseLastWin32Error;
      Terminate;
    end;
    if (dwWaitStatus = WAIT_OBJECT_0) then
    begin
      AddFileToList;
    end;
  end;
eine Verzeichnisüberwachung realisiert. Jetzt möchte ich aber herausbekommen welche Datei sich verändert hat. Ist das mit dem Code von oben möglich? Ich habe in der MSDN nichts dazu gefunden.

Olli 5. Jul 2005 21:02

Re: Dateinamen herausbekommen
 
Diese Informationen bekommst du IMO nur über ReadDirectoryChangesW(). Das andere besagt nur, daß sich etwas geändert hat.

himitsu 1. Sep 2006 12:04

Re: Dateinamen herausbekommen
 
Hinweis bezüglich FILE_ACTION_* im NotifyFilter siehe dort


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:20 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