简体   繁体   English

如何在\\ CLSD \\ {XXXXXXXXX,xxxxxxxx,XXXXX,xxxxx} delphi xe2的HKEY_CLASSES_ROOT中以编程方式创建注册表项?

[英]How can I programmaticaly create registry key in HKEY_CLASSES_ROOT in \CLSD\{XXXXXXXXX,xxxxxxxx,XXXXX,xxxxx} delphi xe2?

I tried to create regisrty key in HKEY_CLASSES_ROOT but windows doesn't allow to do this , I'm trying to create it in HKEY_CURRENT_USER \\SOFTWARE\\Classes\\CLSID{xxxxxx-xxxxxxx-xxxxxxx-xxxxxx}\\abc , but it didn't created. 我试图在HKEY_CLASSES_ROOT中创建注册密钥,但Windows不允许这样做,我试图在HKEY_CURRENT_USER \\ SOFTWARE \\ Classes \\ CLSID {xxxxxx-xxxxxxx-xxxxxxx-xxxxxx} \\ abc中创建它,但是没有创建。

this is my code, whers my fault and how i can solve it. 这是我的代码,提醒我我的错误以及如何解决。

procedure TForm1.FormCreate(Sender: TObject);
const
RegKey = '\Software\Classes\CLSID';
var
Reg: TRegistry;
DelphiPath: String;
begin
Reg:= TRegistry.Create;
Reg.RootKey := HKEY_CURRENT_USER;
Reg.CreateKey('SOFTWARE\Classes\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\abc');
Reg.Free;
end;

The key will have been created. 密钥将被创建。 That you did not report an exception means that the code executed sucessfully. 没有报告异常意味着代码已成功执行。 But HKCU\\Software\\Classes\\CLSID is a redirected key. 但是HKCU\\Software\\Classes\\CLSID是重定向的密钥。 You have a 32 bit process and the registry redirector will have created the key in the 32 bit view, that is HKCU\\Software\\Classes\\Wow6432Node\\CLSID . 您有一个32位进程, 注册表重定向器将在32位视图中创建密钥,即HKCU\\Software\\Classes\\Wow6432Node\\CLSID

If you need to create the key in the 64 bit view you can include the KEY_WOW64_64KEY flag in the Access property of the registry object. 如果需要在64位视图中创建密钥,则可以在注册表对象的Access属性中包含KEY_WOW64_64KEY标志。 This answer has more detail: https://stackoverflow.com/a/9126382/505088 该答案有更多详细信息: https : //stackoverflow.com/a/9126382/505088

However, if your COM server is a 32 bit server, then you should let the redirector do its work. 但是,如果您的COM服务器是32位服务器,则应让重定向器执行其工作。

If all of the above makes no sense to you because you've never heard of the registry redirector then you need to follow the link in the first paragraph before proceeding. 如果以上所有内容对您没有意义,因为您从未听说过注册表重定向器,那么您需要先阅读第一段中的链接,然后再继续。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法在Windows注册表中的HKEY_CLASSES_ROOT下创建密钥 - Unable to create key under HKEY_CLASSES_ROOT in Windows registry 如何在HKEY_CLASSES_ROOT中安全地添加密钥并确保它保留在那里? - How to safely add a key in HKEY_CLASSES_ROOT and be sure it stays there? HKEY_CLASSES_ROOT中的“不允许请求的注册表访问权限” - “Requested registry access is not allowed” in HKEY_CLASSES_ROOT 将新的 subky 添加到 HKEY_LOCAL_MACHINE\\Software\\Classes 后如何更新 HKEY_CLASSES_ROOT - How to update HKEY_CLASSES_ROOT after a new subky is added to HKEY_LOCAL_MACHINE\Software\Classes HKEY_CLASSES_ROOT\CLSID 并非所有子项都被检索。 找不到我的 CLASSID - HKEY_CLASSES_ROOT\CLSID Not all subkeys are retrieved. Can't find my CLASSID HKEY_CLASSES_ROOT\\Directory\\Background\\shell 的问题 - Problems with HKEY_CLASSES_ROOT\Directory\Background\shell 我可以用VBS代码作为资源或dll编译delphi xe2 - can I compile a delphi xe2 with VBS code as a resource or dll 在“Just for me”模式下安装时,无法将值写入hkey_classes_root \\ CLSID - Cannot write value to hkey_classes_root\CLSID when installing in “Just for me” mode 我怎么知道在 HKEY_LOCAL_MACHINE 中创建注册表项的用户名 - how can i know the user name that created the registry key in HKEY_LOCAL_MACHINE 如何确定在Delphi XE2中注册的OCX的版本号 - How to determine the version number of a registered OCX in Delphi XE2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM