当前位置:主页>仓库管理软件> 列表

请问 如何读取注册表中数据为REG_Dword的数值并将结 找qq软件管理

进销存软件版1楼: RT请写出实例!

2楼: 都不会还是闲分太少?? 如qq软件管理

3楼: uses Registry;
procedure TForm1.Button1Click(Sender: TObject);
var
Reg: TRegistry;
iKey: Integer;
str: String;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
If Reg.OpenKeyReadOnly(''Software\Borland'') then
begin
iKey := Reg.ReadInteger(''UseCount''); // 直接读出其值即为integer
str := IntToHex(iKey, 8); // 转化为键值16进制形式而已
end;
Button1.Caption := ''16进制:[ $'' + str + '' ] Integer类型:['' + IntToStr(iKey) + '' ]'';
Reg.CloseKey;
finally
Reg.Free;
end;
end;

4楼: 这样读是会报错误的!!我一开始也这样读的

5楼: 直接用ReadInteger就可以读出来,前提是要判断该键是否存在

6楼: 应该是用ReadInteger,你讲的报错是不是别的错误。你还可以用ReadString将其内容读出来试试看里面到底是什么。