在D的某个目录下有一个DELPHI编写的程序,如何用函数得到我要的目录?如d:\a\delphipragam,我编写程序都在此目录下,我想得到这个目录,将INI文件和一些日志文件放在这里。在线等。
解决方案 »
- 我想把整个panel保存到图片上 怎么老是空的
- 如何知道一个TextFile变量已打开一个文件?
- 如何单击按钮来模拟键盘上的ALT+TAB键
- 哪位知道DevExpress系列有没有教程???
- 关于在DELPHI中使用SQL的问题,请大家帮帮忙!!!!!!!!!!!
- 怎样使qreport报表在生成应用程序后,还能对报表控件进行调整,就像fastreport的frDesigner的功能一样!
- 网络图像传输问题,特急!!!高分奉送
- 关于焦点控制的问题
- 是不是只有装了网卡,才能装Personal Web Server(pws)软件???。
- 高分求教表格制作
- stringgrid如何实现有下拉列表的功能?
- 简单问题:C++中的while(!ADOQuery->Eof){}在delphi中如何表示?
Edit1.Text := ExtractFilePath(Application.ExeName); 带
var
hand : Cardinal;
fd : _WIN32_FIND_DATAA;
filename : PAnsiChar;
item : TListItem;
begin
//分配内存并取得当前目录
ListView1.Clear;
filename := StrAlloc(256);
GetCurrentDirectory(256,filename); StrCat(filename,'\*');
hand := Windows.FindFirstFile(filename,fd);
item:=ListView1.Items.Add;//将找到的文件名加入listview
item.Caption:=fd.cFileName;
while(GetLastError() <> ERROR_NO_MORE_FILES) do//继续查找直到结束
begin
Windows.FindNextFile(hand,fd);
item:=ListView1.Items.Add;
item.Caption:=fd.cFileName; end;
Windows.FindClose(hand);//关闭查找句柄
StrDispose(filename);
end;
//试试这个
var
dir:string;
begin
dir:=ExtractFileDir(Application.Exename);
showmessage(dir);
end;
var strAppDir,ExePath:String;
//获取目录名
SetLength(strAppDir,256);
SetLength(strAppDir, GetModuleFileName(HInstance, PChar(strAppDir), 256));
ExePath:=ExtractFilePath(strAppDir);
if ExePath[Length(ExePath)]<>'\' then ExePath:=ExePath+'\';
Path:=ExtractFilePath (Application.ExeName);
var strAppDir,ExePath:String;
//获取目录名
SetLength(strAppDir,256);
SetLength(strAppDir, GetModuleFileName(HInstance, PChar(strAppDir), 256));
ExePath:=ExtractFilePath(strAppDir);
if ExePath[Length(ExePath)]<>'\' then ExePath:=ExePath+'\';