Solved

Registry interaction syntax

Posted on 1998-07-10
4
151 Views
Last Modified: 2012-05-04
I'm a novice VB programmer and I'm having trouble reading in a registry key value.  What I'm trying to achieve is to read in a string value located in:

HKEY_LOCAL_MACHINE\SOFTWARE\MyCompany\ApplicationName

This value specifies a drive letter.

Here is the syntax I'm trying to use:
G_Current_Drive =
GetSetting( "HKEY_LOCAL_MACHINE\SOFTWARE\Creativeware", "Job Start", "InitDrive")

where G_Current_Drive is a global string variable.

After the user selects another drive letter, I want the program to update the value in the registry, so when the user runs the application and has to choose a drive letter again, it goes back to the last drive letter they were in.

I'm trying to use the "GetSetting" function to retrieve this key, but I can't seem to get it to work.  Am I on the right track?  I would be grateful for any advice or solutions.  Thanks in advance.
0
Comment
Question by:hwilson
  • 3
4 Comments
 

Author Comment

by:hwilson
ID: 1465479
Edited text of question
0
 

Author Comment

by:hwilson
ID: 1465480
Edited text of question
0
 
LVL 6

Accepted Solution

by:
alamo earned 100 total points
ID: 1465481
The GetSetting keyword doesn't allow access to the entire registry - only HKEY_CURRENT_USER\Software\VB and VBA Program Settings\appname\section\key
and thus the hierarchical keys you specify won't work.

there is a Knowledge Base article which describes how to do this, with examples. See it on the web at http://support.microsoft.com/support/kb/articles/q145/6/79.asp If you need more details or have questions on any of this, just ask.

Hope this helps!
0
 

Author Comment

by:hwilson
ID: 1465482
I found the answer at the exact same URL.  Thanks though.

Herbie
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

685 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