把application.MessageBox('文件保存成功!','提示!',64);改到memo1.Lines.SaveToFile(form1.SaveDialog1.FileName );后面,也就是SaveDialog1.Execute =true 时才保存并给出提示,如果点的取消,刚跳过IF里的语句,所以不会提示保存成功。begin form1.SaveDialog1.Filter :='纯文本文件(*.txt)|*.txt'; form1.SaveDialog1.Title :='*.txt'; if form1.SaveDialog1.Execute then begin memo1.Lines.SaveToFile(form1.SaveDialog1.FileName ); application.MessageBox('文件保存成功!','提示!',64); end; end;
-**********************************************************************
保存文件到默认路径
procedure TForm1.Button1Click(Sender: TObject); var Bitmap : TBitmap; begin Bitmap := TBitMap.create; try //Bitmap.LoadFromClipBoardFormat(cf_BitMap,ClipBoard.GetAsHandle(cf_Bitmap),0); Bitmap.SaveToFile( 'C:\screen.bmp '); finally Bitmap.free; end;
mypath:= 'd:\默认路径\ '; assignfile(F,mypath+ '1.txt ') rewrite(f,1); blockwrite(f,buffer^,100,code); closefile(f);
winexec(pchar( 'cmd /c copy ' + 源文件路径及名称 + ' ' + 默认文件路径及名称),sw_hide);
end;