unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, inifiles, ComCtrls, ShellCtrls, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Panel1: TPanel;
Panel2: TPanel;
ShellTreeView1: TShellTreeView;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
IniFile: TIniFile;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
Myinifile :=Tinifile.Create(d:\stlyxp.ini); \\定义配置文件出错的地方
form1.Caption :=myinifile.ReadString('stlypc','菜单名称','') ;\\定义菜单名称
button1.Caption :=myinifile.ReadString('分类','名称1','') ; \\ 定义按钮名称
shelllistview1.Root:=myinifile.ReadString('游戏路径','路径1',''); \\定义启动后窗口加载的目录
end;procedure TForm1.Button1Click(Sender: TObject);
begin
button1.Caption :=myinifile.ReadString('分类','名称1','')
end;end.
出错提示[警告] Unit1.pas(7): Unit 'ShellCtrls' is specific to a platform
[错误] Unit1.pas(33): Undeclared identifier: 'Myinifile'
[错误] Unit1.pas(33): Undeclared identifier: 'd'
[错误] Unit1.pas(33): 'END' expected but ')' found
[错误] Unit1.pas(33): Illegal character in input file: '置' ($D6C3)
[错误] Unit1.pas(34): Illegal character in input file: '\' ($5C)
[错误] Unit1.pas(34): Illegal character in input file: '称' ($B3C6)
[错误] Unit1.pas(35): Illegal character in input file: '\' ($5C)
[错误] Unit1.pas(35): Illegal character in input file: '名' ($C3FB)
[错误] Unit1.pas(36): Illegal character in input file: '\' ($5C)
[错误] Unit1.pas(36): Illegal character in input file: '窗' ($B4B0)
[错误] Unit1.pas(36): Illegal character in input file: '录' ($C2BC)
[错误] Unit1.pas(41): Undeclared identifier: 'myinifile'
[致命错误] Project2.dpr(5): Could not compile used unit 'Unit1.pas'
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, inifiles, ComCtrls, ShellCtrls, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Panel1: TPanel;
Panel2: TPanel;
ShellTreeView1: TShellTreeView;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
IniFile: TIniFile;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
Myinifile :=Tinifile.Create(d:\stlyxp.ini); \\定义配置文件出错的地方
form1.Caption :=myinifile.ReadString('stlypc','菜单名称','') ;\\定义菜单名称
button1.Caption :=myinifile.ReadString('分类','名称1','') ; \\ 定义按钮名称
shelllistview1.Root:=myinifile.ReadString('游戏路径','路径1',''); \\定义启动后窗口加载的目录
end;procedure TForm1.Button1Click(Sender: TObject);
begin
button1.Caption :=myinifile.ReadString('分类','名称1','')
end;end.
出错提示[警告] Unit1.pas(7): Unit 'ShellCtrls' is specific to a platform
[错误] Unit1.pas(33): Undeclared identifier: 'Myinifile'
[错误] Unit1.pas(33): Undeclared identifier: 'd'
[错误] Unit1.pas(33): 'END' expected but ')' found
[错误] Unit1.pas(33): Illegal character in input file: '置' ($D6C3)
[错误] Unit1.pas(34): Illegal character in input file: '\' ($5C)
[错误] Unit1.pas(34): Illegal character in input file: '称' ($B3C6)
[错误] Unit1.pas(35): Illegal character in input file: '\' ($5C)
[错误] Unit1.pas(35): Illegal character in input file: '名' ($C3FB)
[错误] Unit1.pas(36): Illegal character in input file: '\' ($5C)
[错误] Unit1.pas(36): Illegal character in input file: '窗' ($B4B0)
[错误] Unit1.pas(36): Illegal character in input file: '录' ($C2BC)
[错误] Unit1.pas(41): Undeclared identifier: 'myinifile'
[致命错误] Project2.dpr(5): Could not compile used unit 'Unit1.pas'
var Myinifile:TIniFile;
...var
myIniFile: Tinifile;
begin
Myinifile :=Tinifile.Create(d:\stlyxp.ini); \\定义配置文件出错的地方
修改成
Myinifile :=TIniFile.Create('d:\stlyxp.ini'); //定义配置文件出错的地方
...
end;