Recent Posts
Selamat datang di Coding Delphi Land Weblog kumpulan source code pemogram delphi
(Bukan maksud untuk menggurui tetapi marilah kita berbagi ilmu tuk perkembangan kemajuan teknologi kita
Minggu, 15 November 2009
Rename File
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
oldName, newName : string;
begin
// Try to rename the current Unit1.dcu to Uni1.old
oldName := Edit1.Text;
newName := edit2.Text;
if RenameFile(oldName, newName)
then ShowMessage(Edit1.Text+' renamed OK')
else ShowMessage(Edit1.Text+' rename failed with error : '+
IntToStr(GetLastError));
end;
end.
0 komentar:
Posting Komentar