Windows注册表操作的头文件 [英] Header file for Windows Registry Operation

查看:112
本文介绍了Windows注册表操作的头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我必须使用C语言代码更改注册表值.我获得了用于C#的示例代码,以更改HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ StorageDevicePolicies的注册表值.我从网络引用以下路径.
使用C#开发USB存储设备保护工具

在C语言中编译代码时出现错误,我得到的错误是"RegistryKey:undeclared identifier".由于示例代码在C#中,因此头文件就像使用Microsoft.Win32;"

任何人都可以帮助我为C编译添加哪些头文件.
我已经包含了win32.h,但仍然出现相同的错误

问候
Mohan

Hi,

I have to change the registry value using code in C language. I got sample code for C# to change the registry value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies. I refer the below path from net.
Developing a USB Storage Device Protection Tool with C#

I get error while I compile the code in C, I get the error as "RegistryKey:undeclared identifier". As the sample code is in C#, the header file is as "using Microsoft.Win32;"

Can anyone help which header file can i include for C compilation.
I had included win32.h but still i get the same error

Regards
Mohan

推荐答案

您不能在C程序中使用C#代码.两种语言都足够不同,并且仅共享某些语法.例如,C#中没有类似于头文件的文件.

看看MSDN:
http://msdn.microsoft.com/en-us/library/aa914389.aspx [ ^ ]
You can''t use C# code for your C program. Both languages are different enough and only share some syntax. For example there is nothing like header files in C#.

Have a look at the MSDN:
http://msdn.microsoft.com/en-us/library/aa914389.aspx[^]


JF2015是正确的,但是他链接到WinCE文档,这是一个更准确的链接,您可以使用该链接浏览注册表API函数:

http://msdn.microsoft.com/en-us/library/ms724875 (v = VS.85).aspx [注册表API封装程序 [ http://msdn.microsoft.com/en-us/library/xka57xy4 (v = VS.100).aspx [
JF2015 is right, but he linked to the WinCE documentation, here''s a more accurate link that you can use to browse the registry API functions:

http://msdn.microsoft.com/en-us/library/ms724875(v=VS.85).aspx[^]

You can also use one of several wrapper classes that people have written:

Registry API Wrapper[^]

And ATL includes the CRegKey class:

http://msdn.microsoft.com/en-us/library/xka57xy4(v=VS.100).aspx[^]


这篇关于Windows注册表操作的头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆