VB10.net需要管理权限才能访问注册表 [英] VB10.net Need adminstrative permission to access Registry

查看:156
本文介绍了VB10.net需要管理权限才能访问注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

使用我在此网站上找到的以下代码尝试创建注册表项来存储程序中的ID标签:

Hello,

Using this code which I found on this web site to try to create a registry key to store an ID tag from my program:

Imports Microsoft.Win32

Public Class Form1
    Dim regKey As RegistryKey
 'Makes the key  
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        regKey = Registry.LocalMachine.OpenSubKey("Software", True)  
        regKey.CreateSubKey("MyAppV2")
        regKey.Close()
    End Sub

'Delete the key
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        
        regKey = Registry.LocalMachine.OpenSubKey("Software", True)  
        regKey.DeleteSubKey("MyAppV", True)
        regKey.Close()
    End Sub

'Read/write from key:
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim ver As Decimal
        regKey = Registry.LocalMachine.OpenSubKey("Software\MyAppV", True) 
        ' regKey.SetValue("AppName", "MyRegApp")
        ver = regKey.GetValue("Version", 0.0)
        If ver < 1.1 Then regKey.SetValue("Version", 1.1)
        regKey.Close()
    End Sub
End Class


但是当程序运行时(三个按钮中的任何一个),我收到一条错误消息"在部署Office解决方案时,请检查以确保您已满足所有安全要求"
vb项目被设置为完全信任应用程序".该程序正在Vista中运行.

对我可能做错了什么或想念什么有任何想法吗?

谢谢
Gary V


But when the program runs (any of the 3 buttons) I get an error message "When deploying an Office solution, check to make sure that you have fulfilled all security requirements"
The vb project is set as a "Full trust application". The program is running in Vista.

Any thoughts on what I might be doing wrong or missing?

THANKS
Gary V

推荐答案

您可能必须在Vista中更改UAC设置,以允许该程序访问注册表.

请参见此处 [
You might have to change the UAC settings in Vista to allow this program to access the registry.

See here[^].


感谢您的想法...
我尝试了一下...单击自己作为用户的完全访问权限选项...但是在运行代码时仍收到相同的错误消息...注册表访问被拒绝.令人惊奇的是,我可以使用我的VB6代码访问注册表!
再次感谢!
Thanks for the thought...
I gave that a try..clicked on the full access option for myself as a user...but still receive the same error message when I run the code...Registry Access Denied. Amazingly I can access the registry just fine with my VB6 code!
Thanks again!


这篇关于VB10.net需要管理权限才能访问注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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