Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

Setting a Registry Key

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
manx
Asked:
manx
1 Solution
 
proskigCommented:
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
 
MichaelSCommented:
Duplicated question
0
 
RONSLOWCommented:
Or you can use the CRegKey ATL classes which already provide wrappers.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
iDebCommented:
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
 
iDebCommented:
iDeb changed the proposed answer to a comment
0
 
RONSLOWCommented:
Here is my answer (as requested in the duplicate question).
0
 
manxAuthor Commented:
Thanks ROSNLOW
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now