FileListBoxに現在のフォルダの中身を表示したい


リリカ  2021-07-05 12:47:01  No: 149778  IP: [192.*.*.*]

こんにちは。
タイトル通りの質問ですが、フォルダ内のファイルを削除しても
見た目はそのファイルがFileListBoxには残ったままです。
リアルタイムにフォルダ内のファイルを追加・削除すれば、FileListBox
にも追加されたり削除されたりしたいのです。

編集 削除
igy  2021-07-05 13:10:45  No: 149780  IP: [192.*.*.*]

Delphi 7で試しただけですが、
[Samples]にある TShellChangeNotifier をフォームに追加し、

procedure TForm1.FormCreate(Sender: TObject);
var
    CheckDirectory: String;
begin
    CheckDirectory := 'c:\hoge';

    FileListBox1.Directory := CheckDirectory;
    ShellChangeNotifier1.Root := CheckDirectory;
end;

procedure TForm1.ShellChangeNotifier1Change;
begin
    FileListBox1.Update;
end;

編集 削除
リリカ  2021-07-05 22:48:14  No: 149781  IP: [192.*.*.*]

igyさん、ありがとうございました!
なるほど、ShellChangeNotifierを使えばよかったんですね。
うまくいきました。

編集 削除