D
delphi小菜鸟
Unregistered / Unconfirmed
GUEST, unregistred user!
各位,我想读取BIOS信息,读注册表键;代码如下:为什么会不行呢?没有信息读出来。
procedure TmainForm.readbios;
const
Subkey: string = 'Hardware/description/system';
var
Reg: Tregistry;ValueSize,Mtype,OrigSizeWORD;ValueBuf: array[0..1000] of char;H:HKEY;
begin
Reg:=Tregistry.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
try
OrigSize := sizeof(ValueBuf);
ValueSize := OrigSize;
Mtype:=REG_MULTI_SZ;
begin
if Reg.OpenKey(Subkey, true) then
begin
if Reg.ValueExists('SystemBiosVersion') then
begin
if RegQueryValueEx(H,'SystemBiosVersion',Nil,@Mtype,@ValueBuf,@ValueSize)=ERROR_SUCCESS then //在这里就跳过了
bios.caption:='BIOS:'+ValueBuf+'('+Reg.ReadString('SystemBiosDate')+')';
end;
if Reg.ValueExists('VideoBiosDate') then
begin
if RegQueryValueEx(H,'VideoBiosVersion',Nil,@Mtype,@ValueBuf, @ValueSize)=ERROR_SUCCESS then//在这里也跳过了
vbios.caption:='显卡BIOS:' + ValueBuf + '('+Reg.ReadString('VideoBiosDate')+')';
end;
end;
end;
finally
Reg.CloseKey;
Reg.Free;
end;
end;
procedure TmainForm.readbios;
const
Subkey: string = 'Hardware/description/system';
var
Reg: Tregistry;ValueSize,Mtype,OrigSizeWORD;ValueBuf: array[0..1000] of char;H:HKEY;
begin
Reg:=Tregistry.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
try
OrigSize := sizeof(ValueBuf);
ValueSize := OrigSize;
Mtype:=REG_MULTI_SZ;
begin
if Reg.OpenKey(Subkey, true) then
begin
if Reg.ValueExists('SystemBiosVersion') then
begin
if RegQueryValueEx(H,'SystemBiosVersion',Nil,@Mtype,@ValueBuf,@ValueSize)=ERROR_SUCCESS then //在这里就跳过了
bios.caption:='BIOS:'+ValueBuf+'('+Reg.ReadString('SystemBiosDate')+')';
end;
if Reg.ValueExists('VideoBiosDate') then
begin
if RegQueryValueEx(H,'VideoBiosVersion',Nil,@Mtype,@ValueBuf, @ValueSize)=ERROR_SUCCESS then//在这里也跳过了
vbios.caption:='显卡BIOS:' + ValueBuf + '('+Reg.ReadString('VideoBiosDate')+')';
end;
end;
end;
finally
Reg.CloseKey;
Reg.Free;
end;
end;