var temchar,temstr:string; i:integer; begin temstr:=''; for i:=length(edit1.text) downto 1 do begin temchar:=edit1.text[i]; if not (temchar='\') then temstr:=temstr+temchar; end;temstr就是1.wav
在激发opendialog1的事件中加入如下代码: if opendialog1.Execute then edit1.Text :=extractfilename(opendialog1.FileName);
showmessage(opendialog.filename);
ExtractFileExt() 从文件名中抽取扩展名
ExtractFileName() 从文件名中抽取不含路径的文件名
ExtractFilePath() 从文件名中抽取路径名
ExtractFileDir() 从文件名中抽取目录名
ExtractFileDrive() 从文件名中抽取驱动器名
ExpandUNCFileName() 返回含有网络驱动器的文件全路径
ExtractRelativePath() 从文件名中抽取相对路径信息 用OpenDialog.FileName做参数
uses mmsystem;if opendialog1.Execute then
playSound(pchar(opendialog1.FileName),0,0);
我不要前面的d:\my document\
我只要1.wav,请问怎么实现??谢谢大家的积极参与!
temchar,temstr:string;
i:integer;
begin
temstr:='';
for i:=length(edit1.text) downto 1 do
begin
temchar:=edit1.text[i];
if not (temchar='\') then temstr:=temstr+temchar;
end;temstr就是1.wav
if opendialog1.Execute then
edit1.Text :=extractfilename(opendialog1.FileName);