请问这条语句如何出错了?(12分)

  • 主题发起人 主题发起人 awfigsk
  • 开始时间 开始时间
A

awfigsk

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Registry, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Panel1: TPanel;
ListBox1: TListBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

const
ROOT=HKEY_LOCAL_MACHINE;
var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
regist:TRegistry;
i,n:integer;
begin
regist:=TRegistry.Create;
with regist do
begin
if openkey('/SOFTWARE/ODBC/ODBCINST.INI/ODBC Drivers',True) then
begin
if [red]GetKeyInfo(var Value:TRegKeyInfo)[/red] then
begin
n:=value.numsubkeys;
showmessage(inttostr(n));
end;
end;
end;
end;

end.
出错提示: [Error] Unit1.pas(40): Expression expected but 'VAR' found
[Error] Unit1.pas(42): Undeclared identifier: 'value'
[Fatal Error] Project1.dpr(5): Could not compile used unit
请问这是哪里出错了?
 
GetKeyInfo(var Value:TRegKeyInfo)出错啦!!
42行的value是什么东东,都没有定义
 
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Registry, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Panel1: TPanel;
ListBox1: TListBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

const
ROOT=HKEY_LOCAL_MACHINE;
var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
regist:TRegistry;
i,n:integer;
[red] Value: TRegKeyInfo
//放在这[/red]
begin
regist:=TRegistry.Create;
with regist do
begin
if openkey('/SOFTWARE/ODBC/ODBCINST.INI/ODBC Drivers',True) then
begin
[red] if GetKeyInfo(Value) then //注意[/red]
begin
n:=value.numsubkeys;
showmessage(inttostr(n));
end;
end;
end;
end;

 
谢谢!分不多,不好意思!
 

Similar threads

I
回复
0
查看
763
import
I
I
回复
0
查看
686
import
I
S
回复
0
查看
751
SUNSTONE的Delphi笔记
S
I
回复
0
查看
541
import
I
后退
顶部