if fileexists("aa.txt")then
begin
//dothis
end else begin
//doelse
end
或者
if filexists(extractfilepath(application.exename))+"aa.txt") then
begin
//dothis
end else begin
//doelse
end
begin
//dothis
end else begin
//doelse
end
或者
if filexists(extractfilepath(application.exename))+"aa.txt") then
begin
//dothis
end else begin
//doelse
end
解决方案 »
- 一个函数的问题,请朋友们指教!
- 动态连接库的调用?
- 如何让窗体的最大化、最小化、关闭按钮消失,最好是这一行(应该叫系统栏吧)全消失,还有怎么让
- 我想复制程序自身到一个目录应该怎么写呀。
- 如何使form2占满form1上的PANEL1的整个区域?
- SETWINDOWSPOS为什么不能使我的FORM窗体为于所有窗体的最底层?高手在哪?
- Delphi7中的Rav Report控件的问题求助,请高手指点
- 关于tree view 的问题,高手请进,加满分!
- 请教大虾,怎么在linux下装驱动程序??
- 轻松一下,把WIN98 时间指针动起来,试过吗?
- 如何实现将word的表格和文本存入数据库中?
- 请教高手!如何隐藏自己的程序?
Directory: array[0..99] of char;
FileName: String;
Len: Integer;
begin
GetCurrentDirectory(Len, @Directory[0]) //获得当前目录
Directory[Len]:= #0;
FileName:= StrPas(@Directory[0]) + 'aa.txt';
if FileExists(FileName) then //如果存在
begin
end
else
Close();
end;
do something
end
else begin
do something
end;
LPCTSTR lpFileName, // pointer to name of file to search for
LPWIN32_FIND_DATA lpFindFileData
// pointer to returned information
);Return Values
If the function succeeds, the return value is a search handle used in a subsequent call to FindNextFile or FindClose.If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.
获得当前目录用GetCurrentDirectory
获得本程序运行目录用ExtractFilePath(Application.ExeName)