VB10.net需要管理权限才能访问注册表

编程入门 行业动态 更新时间:2024-10-27 08:38:44
本文介绍了VB10需要管理权限才能访问注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好, 使用我在此网站上找到的以下代码尝试创建注册表项来存储程序中的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需要管理权限才能访问注册表

本文发布于:2023-11-11 06:45:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577660.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:注册表   管理权限   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!