to tang_xue_feng,不对....我改了,没有用.
如下代码:
unit1.pas的:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, FileCtrl;
type
TForm1 = class(TForm)
Button3: TButton;
DriveComboBox1: TDriveComboBox;
DirectoryListBox1: TDirectoryListBox;
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.Button3Click(Sender: TObject);
var
f:file;
s:string;
begin
s:=DirectoryListBox1.Directory;
assignfile(f,s);
s:=s+'.{D6277990-4C6A-11CF-8D87-00AA0060F5BF}';
Rename(f,s);
end;
end.
unit1.dfm的:
object Form1: TForm1
Left = 187
Top = 200
Width = 696
Height = 480
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button3: TButton
Left = 384
Top = 56
Width = 75
Height = 25
Caption = 'Button3'
TabOrder = 0
OnClick = Button3Click
end
object DriveComboBox1: TDriveComboBox
Left = 48
Top = 210
Width = 129
Height = 19
DirList = DirectoryListBox1
TabOrder = 1
end
object DirectoryListBox1: TDirectoryListBox
Left = 48
Top = 232
Width = 300
Height = 129
ItemHeight = 16
TabOrder = 2
end
end
Project2.dpr的:
program Project2;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
以上的代码可以直接保存为相应的文件,可以直接运行.
谢谢..