unit2.pas

来自「在delphi中实现windows核心编程.原书光盘代码核心编程.原书光盘代码」· PAS 代码 · 共 53 行

PAS
53
字号
unit Unit2;

interface

uses
  Classes, SysUtils, windows;

type
  TFileChangeNotify = class(TThread)
  private

  protected
    procedure Execute; override;
    procedure filenotify; 
  end;
var
  qh1: thandle;
implementation

uses
  unit1;

procedure TFileChangeNotify.filenotify;
begin
  form1.refreshlist;
end;

procedure TFileChangeNotify.Execute;
var
  pdir: array[0..10] of char;
  st: integer;
begin
  freeOnTerminate:=true;
  strcopy(pdir,pchar(form1.combobox1.items[form1.combobox1.itemindex]));
  qh1 := 0;
  qh1 := FindFirstChangeNotification(pdir, True, FILE_NOTIFY_CHANGE_LAST_WRITE);
  while not Terminated do
  begin
    st := WaitForSingleObject(qh1, INFINITE);
    if Terminated then break;
    if st = WAIT_OBJECT_0 then
    begin
      Synchronize(filenotify);
      SHUpdateRecycleBinIcon;
    end;
    if not findnextchangenotification(qh1) then Terminate;
  end;
end;


end.

 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?