?
Solved

creating a registry entry using vb6

Posted on 2003-03-21
7
Medium Priority
?
135 Views
Last Modified: 2010-05-18
I would like to make an entry in HKEY_LOCAL_MACHINE but in a directory (section) I specify "MyCompany\MyPackage" and finally my key "Registration Code"
So that the result would store my "Registration Code" key and value in the following area.
HKEY_LOCAL_MACHINE\MyCompany\MyPackage\

Also, currently I am storing this registration code simply in
HKEY_LOCAL_MACHINE
However, sometimes the value/key gets erased, is there a better place to store this value.  Could this area change by loggin on as someone else or what should I look for?
0
Comment
Question by:screebar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 

Expert Comment

by:Chimo
ID: 8185088
You have to use windows API to read/write anywere you want in the registry.

You can look here to find a list of API you may use and code example that read and write to regitry:
http://www.mvps.org/vbnet/api/_api/apir.htm
0
 

Author Comment

by:screebar
ID: 8185105
I am currently using "RegCreateKey" however it does not create my "subdirectories" or sections below HKEY_LOCAL_MACHINE
-->>>  MyCompany\MyPackage    <<<<<----
That is what is not happening and I cannot find where you can add these.
0
 

Author Comment

by:screebar
ID: 8185106
I am currently using "RegCreateKey" however it does not create my "subdirectories" or sections below HKEY_LOCAL_MACHINE
-->>>  MyCompany\MyPackage    <<<<<----
That is what is not happening and I cannot find where you can add these.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
Chimo earned 200 total points
ID: 8185127
I think you will have to create all key one after the other.  Check if MyCompany exist, if not create it, after do the same with MyPackage and so on for each key.  After that create and set your values.

Public Sub CreateNewKey(sNewKeyName As String, _
                        lPredefinedKey As Long)

  'handle to the new key
   Dim hKey As Long
   Dim result As Long
   
   Call RegCreateKeyEx(lPredefinedKey, _
                       sNewKeyName, 0&, _
                       vbNullString, _
                       REG_OPTION_NON_VOLATILE, _
                       KEY_ALL_ACCESS, 0&, hKey, result)
   
   Call RegCloseKey(hKey)

End Sub
0
 

Author Comment

by:screebar
ID: 8185207
Ok, your previous link looks like there is some info, it is not "spoon feeding me" thought ;).  I will tinker with it tomorrow.  Thanks for the help, once I succeed I will award the points.  Any more "spoon feeding" would be appreciated!
0
 

Expert Comment

by:CleanupPing
ID: 8531846
Hi screebar,
This old question (QID 20559321) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 8957413
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

-->Accept Chimo's comments as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

GPrentice00
EE Cleanup Volunteer
0

Featured Post

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

770 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