stempdbname:=changefileext(fn,'.tmp');什么意思(10分)

  • 主题发起人 主题发起人 wxcayap
  • 开始时间 开始时间
W

wxcayap

Unregistered / Unconfirmed
GUEST, unregistred user!
stempdbname:=changefileext(fn,'.tmp');这段代码我不懂什么意思
希望高手能够接受一下。小弟在此谢过。
 
补充
var
dao:OLEVariant;
sTempDBname:string;
begin
result:=true;
screen.Cursor:=crHourGlass;
stempdbname:=changefileext(fn,'.tmp');
if fileExists(stempDBName) then DeleteFile(sTempDBName);
dao:=CreateOLEObject('DAO.DBEngine.36');
try
try
dao.compactDatabase(fn,sTempDBName,'',0,';pwd=dltjy');
DeleteFile(fn);
RenameFile(sTempDBName,fn);
except
on e:Exception do begin
result:=False;
MessageDlg('数据库压缩修复失败!!'+#13+#13+e.Message,mtError,[mbOK],0);
end;
end;
finally
dao:=Unassigned;
end;
screen.Cursor:=crDefault;
end;
 
就是更改一个文件的扩展名为TMP.
看DELPHI帮助文件
Changes the extension of a file name.

Unit

SysUtils

Category

file name utilities

function ChangeFileExt(const FileName, Extension: string): string;

Description

ChangeFileExt takes the file name passed in FileName and changes the extension of the file name to the extension passed in Extension. Extension specifies the new extension, including the initial dot character.

ChangeFileExt does not rename the actual file, it just creates a new file name string.

Note: This function works with multi-byte character sets (MBCS).
 
请看DELPHI帮助。
changefileext:
Changes the extension of a file name.

Unit

SysUtils

Category

file name utilities

Delphi syntax:

function ChangeFileExt(const FileName, Extension: string): string;

C++ syntax:

extern PACKAGE AnsiString __fastcall ChangeFileExt(const AnsiString FileName, const AnsiString Extension);

Description

ChangeFileExt takes the file name passed in FileName and changes the extension of the file name to the extension passed in Extension. Extension specifies the new extension, including the initial dot character.

ChangeFileExt does not rename the actual file, it just creates a new file name string.

Note: This function works with multi-byte character sets (MBCS).

This example converts a specified icon to a bitmap. To run this example, add an image, a button, and an Open dialog to a form. Name the button ConvertIcon2Bitmap, and add the following code as its OnClick event handler.
 
后退
顶部