Forum > Operating Systems

How To Form OnNotifyEvent TMessage Parse For Change Directory and Files

(1/1)

samurat2000:
procedure TForm1.OnNotifyEvent(var AMessage: TMessage);
begin
   ....
   ....
end;

In above code, how to TMessage parse to detail change directory and files.

ASerge:
You mean cross-platform behavior like Windows.FindFirstChangeNotification?

samurat2000:
http://stackoverflow.com/questions/31168116/how-to-get-notified-when-disk-free-space-changes

In this link code below.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1; interface uses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, ShlObj, ActiveX; const   SHCNRF_INTERRUPTLEVEL     = $0001;  SHCNRF_SHELLLEVEL         = $0002;  SHCNRF_RECURSIVEINTERRUPT = $1000;  SHCNRF_NEWDELIVERY        = $8000; type  TSHChangeNotifyEntry = record    pidl: PItemIdList;    fRecursive: BOOL;  end;   TForm1 = class(TForm)    procedure FormCreate(Sender: TObject);    procedure FormDestroy(Sender: TObject);  private    procedure OnNotifyEvent(var AMessage:TMessage); message WM_USER;  end; var  Form1: TForm1;  Hand: THandle; function SHChangeNotifyRegister(OwnerHwnd:HWND; fSources:Integer; fEvents:DWord; wMsg:UINT;         cEntries:Integer; var pshcne:TSHChangeNotifyEntry):ULONG; stdcall; external 'shell32.dll'; function SHChangeNotifyDeregister(ulID:ULONG):BOOL; stdcall; external 'shell32.dll'; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject);var Desktop:IShellFolder;    pidl:PItemIdList;    Path:String;    Eaten,attr,Events,Sources:DWord;    cnPIDL:TSHChangeNotifyEntry;begin if Succeeded(SHGetDesktopFolder(Desktop)) then begin  Path:='D:\Test';  if Succeeded(Desktop.ParseDisplayName(0, nil, PWideChar(Path), Eaten, pidl, attr)) then begin   Caption:=Path;   cnPIDL.pidl:=pidl;   cnPIDL.fRecursive:=true;   Sources:=SHCNRF_INTERRUPTLEVEL or SHCNRF_SHELLLEVEL or SHCNRF_NEWDELIVERY or SHCNRF_RECURSIVEINTERRUPT;   Events:=SHCNE_FREESPACE;   Hand:=SHChangeNotifyRegister(Handle, Sources, Events, WM_USER, 1, cnPIDL);;   CoTaskMemFree(pidl);  end; end;end; procedure TForm1.FormDestroy(Sender: TObject);begin SHChangeNotifyDeregister(Hand);end; procedure TForm1.OnNotifyEvent(var AMessage: TMessage);begin if AMessage.Msg = WM_USER then Caption:=Caption+' x';end; end. 
This procedure;

procedure TForm1.OnNotifyEvent(var AMessage: TMessage);
begin
 if AMessage.Msg = WM_USER then Caption:=Caption+' x';
end;

How to AMessage parse for change detail (folder change detail, file change detil ? which file (full path) and which change?

ASerge:
See Processing non-user messages in your window in http://wiki.lazarus.freepascal.org/Win32/64_Interface

Navigation

[0] Message Index

Go to full version