读写入一个REG_MULTI_SZ的串,参数length要加2
解决方案 »
- 获取窗体句柄!
- dll封装托盘功能
- 用ado怎么给treeview增加节点呀!急
- 各位前辈,随着技术的发展,delphi会长久茁壮的发展下去吗,至少在未来5-10年内,入内探讨谢了先
- 一个奇怪的ftp上传问题
- 为什么父Form的ReSize事件不能继承?
- VB&Vs&Delphi(散分)
- 关于MDI的问题
- delphi本身能否建立数据库,而不借用access
- delphi对sqlserver进行查询报 class eoleexception with message '数据库'tempdb'的日志已经满,请悲愤该数据库的日志以释放一些日志空间
- 我1段读2进制的程序,一执行居然自动关闭
- 急!!!,哪里有delphi免费控件下载?多谢!!!
reg.readstring吗?
能不能给我1个例子?
const
Subkey: string = 'Hardware\description\system';
var
hkSB: HKEY;
rType: LongInt;
ValueSize, OrigSize: Longint;
ValueBuf: array[0..1000] of char;
procedure ParseValueBuf(const VersionType: string);
var
I, Line: Cardinal;
S: string;
begin
i := 0;
Line := 0;
while ValueBuf[i] <> #0 do
begin
S := StrPas(@ValueBuf[i]); // move the Pchar into a string
Inc(Line);
Memo1.Lines.Append(Format('%s Line %d = %s',
[VersionType, Line, S])); // add it to a Memo
inc(i, Length(S) + 1); // to point to next sz, or to #0 if at end
end;
end;
begin
if RegOpenKeyEx(HKEY_LOCAL_MACHINE, PChar(Subkey), 0, KEY_READ, hkSB) =
ERROR_SUCCESS then
try
OrigSize := sizeof(ValueBuf);
ValueSize := OrigSize;
rType := REG_MULTI_SZ;
if RegQueryValueEx(hkSB, 'SystemBiosVersion', nil, @rType,
@ValueBuf, @ValueSize) = ERROR_SUCCESS then
ParseValueBuf('System BIOS Version'); ValueSize := OrigSize;
rType := REG_SZ;
if RegQueryValueEx(hkSB, 'SystemBIOSDate', nil, @rType,
@ValueBuf, @ValueSize) = ERROR_SUCCESS then
Memo1.Lines.Append('System BIOS Date ' + ValueBuf); ValueSize := OrigSize;
rType := REG_MULTI_SZ;
if RegQueryValueEx(hkSB, 'VideoBiosVersion', nil, @rType,
@ValueBuf, @ValueSize) = ERROR_SUCCESS then
ParseValueBuf('Video BIOS Version'); ValueSize := OrigSize;
rType := REG_SZ;
if RegQueryValueEx(hkSB, 'VideoBIOSDate', nil, @rType,
@ValueBuf, @ValueSize) = ERROR_SUCCESS then
Memo1.Lines.Append('Video BIOS Date ' + ValueBuf);
finally
RegCloseKey(hkSB);
end;
end;
这里用在multi_sz上也可以,可以读取键值中的16进制数据,通过转换就可以得到具体内容了