Delphi用SendMessage获取目录下所有文件
━━━━━━━━━━━━━━━━━━━━━━━━━━
procedure TForm1.btn1Click(Sender: TObject);
const
DIRATTR = DDL_READWRITE or DDL_READONLY or DDL_HIDDEN or DDL_SYSTEM or
DDL_ARCHIVE or DDL_DIRECTORY {or DDL_DRIVES} ;
sPath = 'F:\音乐'; //目录可以自己定义为动态参数
var
Files : string;
begin
Files := '*.*'; //查找文件类型
SetCurrentDirectory(sPath);
SendMessage(Lst1.Handle, LB_DIR, DIRATTR, LParam(Files)) ;
end;
关键字词: