标题:注册表如何读写reg_bianry数据?
只看楼主
calf18
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-10-14
结帖率:0
已结贴  问题点数:20 回复次数:2 
注册表如何读写reg_bianry数据?
注册表中字符串的读写已经解决,但reg_bianry数据如何读写,有几点疑问:

1、注册表中显示的值(hex)和以下语句读取bytevalue的值不一样:

Dim subvalue() As String,currentuser As RegistryKey,bytevalue() As Byte
currentuser = ("Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedPidlMRULegacy", True)
subvalue = currentuser.GetValueNames
j = subvalue.GetUpperBound(0)
For i = 0 To j
    bytevalue = currentuser.GetValue(subvalue(i))
Next

2、如何将bytevalue转换成字符串,用System.Text.Encoding.Unicode.GetString(bytevalue)只能得到一部分;

3、如何写入reg_binary值,以下语句不行

currentuser.SetValue(valuekey, setbytevalue, RegistryValueKind.Binary)
setbytevalue为byte数组
搜索更多相关主题的帖子: 注册表 bianry reg 数据 
2010-10-15 10:35
不说也罢
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:39
帖 子:1481
专家分:4989
注 册:2007-10-7
得分:10 
你这样肯定读不出来准确的
程序代码:
        Dim subvalue() As String, currentuser As RegistryKey, bytevalue() As Byte
        currentuser = ("Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedMRU")
        '上面这行请键入准确的注册表键值
        subvalue = currentuser.GetValueNames
        Dim s As String
        For Each s In subvalue
            Dim mykind As RegistryValueKind = currentuser.GetValueKind(s)
            Select Case mykind
                Case RegistryValueKind.Binary
                    bytevalue = CType(currentuser.GetValue(s), Byte())
                    MsgBox(System.Text.Encoding.Unicode.GetString(bytevalue))
            End Select
        Next s


===================================================
讨厌C#的行尾的小尾巴;和一对大括号{ }
===================================================
2010-10-15 13:20
liuliang9767
Rank: 2
等 级:论坛游民
帖 子:12
专家分:31
注 册:2010-10-13
得分:10 
http://www.

JAVA开发工程师
ss
北京搜狐互联网信息服务有限公司
公司类型:民营公司 公司规模:150-500人 ss
发布时间 :2010-09-28 工作年限 :不限 工作方式 :全职 薪金待遇 :面议 性别要求 :不限 招聘人数 :25 到期时间 :2010-10-28 户口要求 :无要求
2010-10-19 13:37



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-322955-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026938 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved