GetRegKey

 

Description

get the registry key in the general area for the Origin software

Syntax

string GetRegKey( BOOL bLanguage = TRUE )

Parameters

bLanguage
[input] TRUE if to get to the subpath for language specific users, which is most typically the case

Return

A string containing the full path (key) that can be used in the Registry class

Examples

EX1

// This is a self contained sample program for the function getRegKey, 
// To run the program, enter the following command in the Script window:
//    getRegKey_ex1
// When you run this program, the following meassages will be printed out:
//   Main Origin registry key is here under HKEY_CURRENT_USER:
//      Software\OriginLab\Origin 7.5\English
//   User Path is stored as: 
//      E:\myApps\Origin\myOwn    //   Root of Origin registry keys. Nothing interesting here:
//      Software\OriginLab\Origin 7.5
//
#include <settings.h>
void GetRegKey_ex1()
{
    Registry reg(HKEY_CURRENT_USER);
    
    //Get the main Origin registry key. Each Origin language product has it's own registry key. 
    //bLanguage is TRUE by default.
    string strKey = GetRegKey(); // demonstration of GetRegKey with the default parameter
    printf("  Main Origin registry key is here under HKEY_CURRENT_USER:\n    %s\n", strKey);
    
    //now get the Path value
    string strUserPath;
    if(reg.GetValue(strKey, "Path", strUserPath))
        printf("  User Folder path stored at \"Path\":\n    %s\n", strUserPath);
    
    //If bLanguage is false, GetRegKey gets the key above the main key. Nothing interesting here.
    strKey = GetRegKey(FALSE); // demonstration of GetRegKey
    printf("  Root of Origin registry keys. Nothing interesting here:\n    %s\n", strKey);
}

Remark

get the registry key in the general area for the Origin software

See Also

header to Include

origin.h

Reference