Solved

Setting a Registry Key

Posted on 2000-05-16
7
219 Views
Last Modified: 2013-11-20
Hi,
   My App uses some API's that require a certain registry key to be set.
So as part of the initilisation of my app, I need to check if such a key exists and if not to create it.

So how do I go abt doing that?
i.e

Reading the key and then possible setting the appropriate key

Is there any MFC, Win32 command to do so ?

Thanks and Regards

ManX


0
Comment
Question by:manx
[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
 
LVL 5

Expert Comment

by:proskig
ID: 2813894
If it is a part of API, not of your program, it is better to use Win 32 functions, e.g. RegQueryValueEx. There are some wrappers for this functions on www.codeguru.com 
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 2814151
Duplicated question
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2815355
Or you can use the CRegKey ATL classes which already provide wrappers.
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!

 
LVL 2

Expert Comment

by:iDeb
ID: 2817926
Heres a list of registry apis you can use:-

RegCreateKeyEx Creates the specified registry key.
RegDeleteKey Deletes a subkey.
RegDeleteValue Removes a named value from the specified registry key.
RegEnumKeyEx Enumerates subkeys of the specified open registry key.
RegEnumValue Enumerates the values for the specified open registry key.
RegLoadKey Creates a subkey under HKEY_USERS or HKEY_LOCAL_MACHINE and stores registration information from a specified file into that subkey.
RegOpenCurrentUser Retrieves a handle to the HKEY_CURRENT_USER key for the user the current thread is impersonating.
RegOpenKeyEx Opens the specified registry key.
RegOpenUserClassesRoot Retrieves a handle to the HKEY_CLASSES_ROOT key for the specified user.
RegQueryInfoKey Retrieves information about the specified registry key.
RegQueryMultipleValues Retrieves the type and data for a list of value names associated with an open registry key.
RegQueryValueEx Retrieves the type and data for a specified value name associated with an open registry key.
RegReplaceKey Replaces the file backing a registry key and all its subkeys with another file.
RegSetValueEx Sets the data and type of a specified value under a registry key.
RegUnLoadKey Unloads the specified registry key and its subkeys from the registry.
0
 
LVL 2

Expert Comment

by:iDeb
ID: 2818363
iDeb changed the proposed answer to a comment
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 50 total points
ID: 2819414
Here is my answer (as requested in the duplicate question).
0
 

Author Comment

by:manx
ID: 2821597
Thanks ROSNLOW
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

691 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