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

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;

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