Solved

using the registrykey command (as opposed to the getallsettings command)

Posted on 2003-11-16
4
545 Views
Last Modified: 2012-06-27
as most people know (and i just found out), the getallsettings command in access VB is limited to the vb settings folder of the hkey_current_user portion of the registry.

here's the code i *was* using:

---
    Dim MySettings As Variant, intSettings As Integer, copyprotect As String

    ' Check registry settings
    MySettings = GetAllSettings(appname:="MyProgram", section:="Startup")
    For intSettings = LBound(MySettings, 1) To UBound(MySettings, 1)
        If intSettings = 0 Then
            If MySettings(intSettings, 0) = "Right" And MySettings(intSettings, 1) = "5" Then
                copyprotect1 = "okay"
            End If
        ElseIf intSettings = 1 Then
            If MySettings(intSettings, 0) = "Bottom" And MySettings(intSettings, 1) = "7" Then
                copyprotect2 = "okay"
            End If
        End If
    Next intSettings
---

my problem is that i need to be able to read settings from the hkey_local_machine portion of the registry.  after reading about the .net framework on the msdn site, i'm confused regarding the proper use of the registrykey command.

can anyone help me do what i was doing before now that i'm playing with what seems to be a totally different command?

(i'm using access 2000, if that makes any difference.)

thanx!
danielle
www.brownflower.com/danielletx
0
Comment
Question by:danielletx
  • 2
4 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 9762104
There are some examples of reading registry entries here
http://www.mvps.org/access/api/api0015.htm

Pete
0
 
LVL 4

Expert Comment

by:inox
ID: 9762992

you can use

    Dim objWSH As Object    
    Set objWSH = CreateObject("WScript.Shell")

e.g.    objWSH.RegWrite "HKLM\Software\MyApplication\strValue",
"Some string value"

objWSH.RegWrite "HKLM\Software\MyApplication\key1", 1234, "REG_DWORD"

0
 

Author Comment

by:danielletx
ID: 9773491
i REALLY like the elegance and brevity of inox's comment.  the only problem is that the objWSH.RegWrite command actually *writes* a value to the registry rather than reading it.

i tried to use objWSH.RegRead, and i get an error.

is there some way to use the whol objWSH thing that will look for the path that i specified in my question...?

sorry.  i'm a little dense when it comes to VB, and so i have a hard time making even tiny little logical leaps.

thanx so much for all the help everyone has offered!  :)
danielle
http://www.brownflower.com/danielletx
0
 
LVL 4

Accepted Solution

by:
inox earned 125 total points
ID: 9776976

danielle,
of course the objWSH ("WScript.Shell") can read values from registry, can you post your commands
or verify to be like

  Dim objWSH As Object
  Set objWSH = CreateObject("WScript.Shell")
  objWSH.RegWrite "HKCU\Software\VB and VBA Program Settings\App1\Sect1\DW1", 123, "REG_DWORD"
  L = objWSH.RegRead("HKCU\Software\VB and VBA Program Settings\App1\Sect1\DW1")
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now