开发者

Read and Write to Window Registry in window xp and 7

开发者 https://www.devze.com 2023-03-28 04:40 出处:网络
I\'d like to read and write window registry in window xp and 7 by using vb6. I\'m not much strong in vb6. I tried this below

I'd like to read and write window registry in window xp and 7 by using vb6. I'm not much strong in vb6. I tried this below

Dim str As String
str = GetSetting("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines", "Text", "ImportMixedTypes")

My cod开发者_如何转开发ing doesn't work. Please point out my missing.


You can't use GetSetting for that setting. That method is only for reading/writing configuration settings for your own application. If you want to read anywhere in the registry you have to use the Windows API function RegOpenKeyEx and friends.

Here's a Microsoft support article that explains how to do this (with sample code): How To Use the Registry API to Save and Retrieve Setting

Note that you will have to have permission to read the relevant place in the registry, I'm not sure if you'll have access to that key so you'll have to try it out.


HKEY_LOCAL_MACHINE can cause permission problems. described in these article Microsoft API article

procedures works well if you will change HKEY_LOCAL_MACHINE to CURRENT_USER.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号