delphi7做了一个资源管理器。
但是不会搜索指定目录,请高人指点一下~。不胜感激!
但是不会搜索指定目录,请高人指点一下~。不胜感激!
解决方案 »
- 关于delphi fastreport显示delphi窗体的输入值
- 提示找不到字段,急急急,sos
- 在Form中不能保存自定义内容?Form的DefineProperties不起作用?
- 有关报表套打的问题。
- 我用了一个query1.close但此query1前并没有打开,所以系统报错,怎么用一个判断避免query1是否打开?
- 请问怎样获得Dll里Export函数的参数信息?我说的是自己写程序获得,谢谢
- 急:調用dll函數時參數傳遞出錯,請幫忙解決
- 为什么修改checkbox总是修改第一条呢?急求!
- 请问怎样编程得到smtp服务器的cname地址和mx记录,?
- Delphi做的Vcl怎么把他生成.lib
- 急帮!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 100分相送!请教各位,这样的form该怎么写?
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,shellapi,FileCtrl;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
ListBox1: TListBox;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
procedure SearchFiles(CurrentPath : AnsiString);
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.SearchFiles(CurrentPath : AnsiString);
var
sr : TSearchRec;
FileInfo : TSHFileInfo;
iFound : Integer;
begin
iFound := FindFirst(CurrentPath + '*.*', faAnyFile, sr);
while iFound=0 do
begin
if (sr.Attr<>faDirectory)and(sr.Name<>'.')and(sr.Name<>'..') then
begin
SHGetFileInfo(PChar(CurrentPath+sr.Name), 0, FileInfo, SizeOf(FileInfo), SHGFI_TYPENAME);
ListBox1.Items.Add(FileInfo.szTypeName);
end;
iFound := FindNext(sr);
end;
FindClose(sr);
end;procedure TForm1.Button1Click(Sender: TObject);
var
SelectPath : AnsiString;
begin
SelectPath := '';
if SelectDirectory('请您选择分类库所对应的路径:', '', SelectPath) then
begin
if Length(SelectPath) <> 3 then
SelectPath := SelectPath + '\';
ListBox1.Items.Clear;
SearchFiles(SelectPath);
end;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
ListBox1.Items.Clear;
SearchFiles('C:\Winnt\system32\');
end;end.
uses QDialogs;procedure TForm1.Button1Click(Sender: TObject);
var
SelectPath: WideString;
begin
{...}
if SelectDirectory('路径: ', '' , SelectPath) then
{...}
end;