Solved

Registry interaction syntax

Posted on 1998-07-10
4
148 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

861 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

25 Experts available now in Live!

Get 1:1 Help Now