从Vista上的注册表中读取 [英] Read from Registry on Vista

查看:44
本文介绍了从Vista上的注册表中读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用这种方法从注册表中读取。

Dim f作为新的RegistryPermission(RegistryPermissionAccess.AllAcc ess,_

" HKEY_LOCAL_MACHINE \ SOFTWARE \\ \\ SRS

Enterprises\Coordinator\Settings")

''Vlad 02/12/2007

Dim f2 As New

RegistryPermission(RegistryPermissionAccess.AllAcc ess,_

" HKEY_CURRENT_USER \Software \Classes \ VirtualStore \M ACHINE \ SOFTWARE \ SRS

Enterprises\Coordinator\Settings")

Dim pRegKey As RegistryKey = Registry.LocalMachine

pRegKey.OpenSubKey(" SOFTWARE \\ SRS

Enterprises\\Coordinator \\Settings")

Dim val As Object = pRegKey.GetValue(" CSSLQN")

>
适用于Windows XP上的Windows XP。它不适用于Vista

Business。 pRegKey.GetValue(" CSSLQN")返回null。值为

的密钥存在。


我应该在代码中添加什么来从注册表中获取值?

谢谢你是这样的。
Vovan

解决方案

在注册表许可声明之后你不会使用需求或断言。

所以,你宣布它但从不使用它


Dim f作为新的RegistryPermission(RegistryPermissionAccess.AllAcc ess,

" HKEY_LOCAL_MACHINE\SOFTWARE \ SRS Enterprises\Coordinator\Settings")

f.Demand()''我个人使用ASSERT,因为最后你可以使用

f.RevertAssert(),但你不能用Demand做这个()


请试试&回帖


-

新手编码器

(这只是一个名字)

谢谢

我一个接一个地尝试过。钥匙仍然无效。


Vovan


" Newbie Coder" < ne ********* @ spammeplease.com写信息

news:uj ************** @ TK2MSFTNGP02.phx.gbl。 ..


注册表许可声明之后你不会使用需求或断言。

所以,你声明它但从不使用它


Dim f作为新的RegistryPermission(RegistryPermissionAccess.AllAcc ess,

" HKEY_LOCAL_MACHINE\SOFTWARE\SRS Enterprises\Coordinator\Settings")


f.Demand()''我个人使用ASSERT,因为最后你可以使用

f.RevertAssert(),但你不能用需求来做()


请尝试&回帖


-

新手编码器

(这只是一个名字)

>



首先,为什么当你只是阅读时,你是否将权限设置为所有访问权限?第二,为什么你用\\而不是\?


也许你需要校对你的文件


steve

" vovan" < so ***** @ vovan.com写了留言

新闻:%2 **************** @ TK2MSFTNGP06.phx.gbl .. 。


我正在使用这种方法从注册表中读取。

Dim f作为新的RegistryPermission(RegistryPermissionAccess.AllAcc ess,_

" HKEY_LOCAL_MACHINE\SOFTWARE\SRS

Enterprises\Coordinator\Settings")

''Vlad 02/12/2007

Dim f2 As New

RegistryPermission(RegistryPermissionAccess.AllAcc ess,_


" HKEY_CURRENT_USER \Software \Classes \ VirtualStore \M ACHINE \ SOFTWARE \ SRS

Enterprises\Coordinator\Settings")

Dim pRegKey As RegistryKey = Registry.LocalMachine

pRegKey.OpenSubKey(" SOFTWARE \\SRS

Enterprises \\Coordinator\\Settings")

Dim val As Object = pRegKey.GetValue(" CSSLQN")

它适用于Windows XP上的Windows XP。它不适用于Vista

商业。 pRegKey.GetValue(" CSSLQN")返回null。值为

的密钥存在。


我应该在代码中添加什么来从注册表中获取值?

谢谢你


Vovan


I''m using this approach to read from registry.
Dim f As New RegistryPermission(RegistryPermissionAccess.AllAcc ess, _
"HKEY_LOCAL_MACHINE\SOFTWARE\SRS
Enterprises\Coordinator\Settings")
''Vlad 02/12/2007
Dim f2 As New
RegistryPermission(RegistryPermissionAccess.AllAcc ess, _
"HKEY_CURRENT_USER\Software\Classes\VirtualStore\M ACHINE\SOFTWARE\SRS
Enterprises\Coordinator\Settings")

Dim pRegKey As RegistryKey = Registry.LocalMachine
pRegKey.OpenSubKey("SOFTWARE\\SRS
Enterprises\\Coordinator\\Settings")
Dim val As Object = pRegKey.GetValue("CSSLQN")

It works on Windows XP, on Windows Server 2003. It doesn''t work on Vista
Business. pRegKey.GetValue("CSSLQN") returns null. The key with value
exists.

What should I add to my code to get the value from a registry?
Thank you

Vovan

解决方案

After the registry permission declaration you don''t use demand or assert.
So, you declare it but never use it

Dim f As New RegistryPermission(RegistryPermissionAccess.AllAcc ess,
"HKEY_LOCAL_MACHINE\SOFTWARE\SRS Enterprises\Coordinator\Settings")

f.Demand() '' Personally I use ASSERT because at the end you can use
f.RevertAssert(), but you cannot do that with Demand()

Please try & post back

--
Newbie Coder
(It''s just a name)


Thank you
I tried both one by one. I still get null from the key.

Vovan

"Newbie Coder" <ne*********@spammeplease.comwrote in message
news:uj**************@TK2MSFTNGP02.phx.gbl...

After the registry permission declaration you don''t use demand or assert.
So, you declare it but never use it

Dim f As New RegistryPermission(RegistryPermissionAccess.AllAcc ess,
"HKEY_LOCAL_MACHINE\SOFTWARE\SRS Enterprises\Coordinator\Settings")

f.Demand() '' Personally I use ASSERT because at the end you can use
f.RevertAssert(), but you cannot do that with Demand()

Please try & post back

--
Newbie Coder
(It''s just a name)



First of all, why do you set the permissions to all access when you are just
reading? Second, why are you using \\ instead of \ ?

maybe you need to proofread your doce

steve

"vovan" <so*****@vovan.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...

I''m using this approach to read from registry.
Dim f As New RegistryPermission(RegistryPermissionAccess.AllAcc ess, _
"HKEY_LOCAL_MACHINE\SOFTWARE\SRS
Enterprises\Coordinator\Settings")
''Vlad 02/12/2007
Dim f2 As New
RegistryPermission(RegistryPermissionAccess.AllAcc ess, _

"HKEY_CURRENT_USER\Software\Classes\VirtualStore\M ACHINE\SOFTWARE\SRS
Enterprises\Coordinator\Settings")

Dim pRegKey As RegistryKey = Registry.LocalMachine
pRegKey.OpenSubKey("SOFTWARE\\SRS
Enterprises\\Coordinator\\Settings")
Dim val As Object = pRegKey.GetValue("CSSLQN")

It works on Windows XP, on Windows Server 2003. It doesn''t work on Vista
Business. pRegKey.GetValue("CSSLQN") returns null. The key with value
exists.

What should I add to my code to get the value from a registry?
Thank you

Vovan


这篇关于从Vista上的注册表中读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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