delphi中如何打开指定文件夹

问题如题,我希望以浏览的方式显示文件夹中内容,如delphi同目录下有几个文件夹,希望高手能写出文件夹其它相关操作的代码.我急用,网上找了一下,有点费时,先谢谢回复的热心... 问题如题,我希望以浏览的方式显示文件夹中内容,如delphi同目录下有几个文件夹,希望高手能写出文件夹其它相关操作的代码.
我急用,网上找了一下,有点费时,先谢谢回复的热心人:谢谢。
提示:就像我们插入CD时,浏览CD那种效果。不是选择安装路径的那种。
展开
 我来答
快乐居家美食
2006-11-30 · TA获得超过1943个赞
知道大有可为答主
回答量:2392
采纳率:100%
帮助的人:1549万
展开全部
uses
ShellAPI;

ShellExecute(Handle,'open','Explorer.exe','C:\Windows',nil,1);

这样可以打开C:\Windows,如果需要其它目录的话,可以自己设置一下就行了。
伏魔双雷灭神
2006-11-30 · 超过35用户采纳过TA的回答
知道答主
回答量:76
采纳率:0%
帮助的人:0
展开全部
用listview可以浏览文件夹

procedure TForm1.findfiles(APath:string;listview:Tlistview);
var
FSearchRec,DSearchRec:TSearchRec;
FindResult:integer;
newitems:Tlistitem;
begin
findresult:=findfirst(Apath,faanyfile,fsearchrec);
listview.Items.Clear;
try
while findresult=0 do
begin
if (fsearchrec.name<>'.')and(fsearchrec.name<>'..') then
begin
newitems:=listview.items.add;
newitems.Caption:=copy(fsearchrec.Name,1,length(fsearchrec.name)-4);
newitems.ImageIndex:=0;
end;
findresult:=findnext(fsearchrec)
end;
findresult:=findfirst(apath+'*.*',fadirectory,dsearchrec);
while findresult=0 do
findresult:=findnext(dsearchrec);
finally
findclose(fsearchrec);
end;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
listname:='文件夹的路径';
FindFiles(listname+'*.*',listview1);
end

delphi 的Demo目录下的Virtual List View Demo

打两个&&就可以了。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式