如何判断注册表键值是否等于某个值? 比如说 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DRM下的二进制值 DataPath如何读取这个值,然后将其转换成字符串显示出来? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var Reg: TRegistry;begin Reg:=TRegistry.create; Reg.rootkey:=HKEY_LOCAL_MACHINE; Reg.openkey('SOFTWARE\Microsoft\DRM',true); Reg.ReadString('DataPath'); //读取出来的值,返回值直接是字符串类型的 Reg.closekey; Reg.free;end; TRegistry.ReadBinaryData不是刚发帖问过了吗,重开帖讨论? 参看http://topic.csdn.net/u/20100508/10/754b5570-5c1d-4c69-acb9-748b6cae042c.html?27657分类型读取 var DRM : TRegistry; buffer : array[1..1024] of Char; i:Integer;begin DRM := TRegistry.create; DRM.RootKey := HKEY_LOCAL_MACHINE; DRM.OpenKey('\SOFTWARE\Microsoft\DRM', True); i:=DRM.GetDataSize('DataPath'); DRM.ReadBinaryData('DataPath',buffer,i); ShowMessage(Copy(buffer,1,i div 2)); DRM.Free;end; {我只给出如何读取,至于如何比较我认为网络上很多delphi2010测试通过2010-05-09}var Reg: TRegistry; P: PByte; DataInfo: TRegDataInfo;begin Reg := TRegistry.Create; Reg.RootKey := HKEY_LOCAL_MACHINE; Reg.OpenKey('SOFTWARE\Microsoft\DRM', False); try Reg.GetDataInfo('DataPath', DataInfo); GetMem(P, DataInfo.DataSize); Reg.ReadBinaryData('DataPath', P^, DataInfo.DataSize); ShowMessage(PChar(P));//得到结果咯 finally FreeMem(P); Reg.CloseKey; Reg.Free; end;end; {我发现我也够无聊的下面是 delphi7 测试通过代码,结果显示为:C:\Documents and Settings\All Users\DRM2010-05-09}var Reg: TRegistry; P: PByte; DataInfo: TRegDataInfo;begin Reg := TRegistry.Create; Reg.RootKey := HKEY_LOCAL_MACHINE; Reg.OpenKey('SOFTWARE\Microsoft\DRM', False); try Reg.GetDataInfo('DataPath', DataInfo); GetMem(P, DataInfo.DataSize); Reg.ReadBinaryData('DataPath', P^, DataInfo.DataSize); ShowMessage(PWideChar(P));//得到结果咯 finally FreeMem(P); Reg.CloseKey; Reg.Free; end;end; {我发现我也够无聊的下面是 delphi2007 测试通过代码,结果显示为:C:\Documents and Settings\All Users\DRM2010-05-09}var Reg: TRegistry; P: PByte; DataInfo: TRegDataInfo;begin Reg := TRegistry.Create; Reg.RootKey := HKEY_LOCAL_MACHINE; Reg.OpenKey('SOFTWARE\Microsoft\DRM', False); try Reg.GetDataInfo('DataPath', DataInfo); GetMem(P, DataInfo.DataSize); Reg.ReadBinaryData('DataPath', P^, DataInfo.DataSize); ShowMessage(PWideChar(P));//得到结果咯 Edit1.Text := PWideChar(P); finally FreeMem(P); Reg.CloseKey; Reg.Free; end;end; 急啊 调用问题~~帮帮忙啊 如何打开默认的浏览器,而不只是IE,现在的浏览器种类多,用户使用习惯不同。顶者有分。 原创发布Windows无忧助手 V4.0 Beta 2,绝对实用的系统工具!!来者有分!!!!!! 数据转换 如何做收发电子邮件(用SMTP和POP协议)? 音频压缩问题,请高手指教 资料导航算法 弱弱的问一声:还有多少人打算学Delphi InstallShield自动改变默认路经! 人性化程序设计(2)-何为灌金! 谁能帮我实现这个功能,grid某列自动显示为日期 Delphi ocx
var
Reg: TRegistry;
begin
Reg:=TRegistry.create;
Reg.rootkey:=HKEY_LOCAL_MACHINE;
Reg.openkey('SOFTWARE\Microsoft\DRM',true);
Reg.ReadString('DataPath'); //读取出来的值,返回值直接是字符串类型的
Reg.closekey;
Reg.free;
end;
不是刚发帖问过了吗,重开帖讨论?
DRM : TRegistry;
buffer : array[1..1024] of Char;
i:Integer;
begin
DRM := TRegistry.create;
DRM.RootKey := HKEY_LOCAL_MACHINE;
DRM.OpenKey('\SOFTWARE\Microsoft\DRM', True);
i:=DRM.GetDataSize('DataPath');
DRM.ReadBinaryData('DataPath',buffer,i);
ShowMessage(Copy(buffer,1,i div 2));
DRM.Free;
end;
{我只给出如何读取,至于如何比较我认为网络上很多
delphi2010测试通过
2010-05-09
}
var
Reg: TRegistry;
P: PByte;
DataInfo: TRegDataInfo;
begin
Reg := TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Microsoft\DRM', False);
try
Reg.GetDataInfo('DataPath', DataInfo);
GetMem(P, DataInfo.DataSize);
Reg.ReadBinaryData('DataPath', P^, DataInfo.DataSize);
ShowMessage(PChar(P));//得到结果咯
finally
FreeMem(P);
Reg.CloseKey;
Reg.Free;
end;
end;
下面是 delphi7 测试通过代码,
结果显示为:C:\Documents and Settings\All Users\DRM
2010-05-09
}
var
Reg: TRegistry;
P: PByte;
DataInfo: TRegDataInfo;
begin
Reg := TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Microsoft\DRM', False);
try
Reg.GetDataInfo('DataPath', DataInfo);
GetMem(P, DataInfo.DataSize);
Reg.ReadBinaryData('DataPath', P^, DataInfo.DataSize);
ShowMessage(PWideChar(P));//得到结果咯
finally
FreeMem(P);
Reg.CloseKey;
Reg.Free;
end;
end;
下面是 delphi2007 测试通过代码,
结果显示为:C:\Documents and Settings\All Users\DRM
2010-05-09
}
var
Reg: TRegistry;
P: PByte;
DataInfo: TRegDataInfo;
begin
Reg := TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Microsoft\DRM', False);
try
Reg.GetDataInfo('DataPath', DataInfo);
GetMem(P, DataInfo.DataSize);
Reg.ReadBinaryData('DataPath', P^, DataInfo.DataSize);
ShowMessage(PWideChar(P));//得到结果咯
Edit1.Text := PWideChar(P);
finally
FreeMem(P);
Reg.CloseKey;
Reg.Free;
end;
end;