Anzeige:
Ergebnis 1 bis 3 von 3

Thema: C/C++ windows registry ändern?

  1. #1
    lama][Fx
    Gast

    Exclamation C/C++ windows registry ändern?

    hallo forum,

    wie kann ich über c/c++ die windows registry editieren?

    genauer: ich möchte die umgebungsvariable PATH editieren (global).
    die funktionen set/getenv funktionieren nur lokal und auch nur für die laufzeit des programms.

    vielen dank.

  2. #2
    Registrierter Benutzer
    Registriert seit
    04.05.2005
    Ort
    Dortmund
    Beiträge
    31
    http://msdn.microsoft.com

    Mfg, Lord Kefir

  3. #3
    Registrierter Benutzer
    Registriert seit
    05.06.2003
    Beiträge
    118
    Aus dem Win32-SDK:

    Code:
    The RegCreateKey function creates the specified key. If the key already exists in the registry, the function opens it. This function is provided for compatibility with Windows version 3.1. Win32-based applications should use the RegCreateKeyEx function. 
    
    LONG RegCreateKey(
        HKEY hKey,	// handle of an open key 
        LPCTSTR lpSubKey,	// address of name of subkey to open 
        PHKEY phkResult 	// address of buffer for opened handle 
    );	
     
    
    Parameters
    
    hKey
    
    Identifies a currently open key or any of the following predefined reserved handle values: 
    
    HKEY_CLASSES_ROOT
    HKEY_CURRENT_USER
    HKEY_LOCAL_MACHINE
    HKEY_USERS
    The key opened or created by this function is a subkey of the key identified by hKey. 
    
    lpSubKey
    
    Points to a null-terminated string specifying the name of a key that this function opens or creates. This key must be a subkey of the key identified by the hKey parameter. 
    
    If hKey is one of the predefined keys, lpSubKey may be NULL. In that case, the handle returned by using phkResult is the same hKey handle passed in to the function. 
    
    phkResult
    
    Points to a variable that receives the handle of the opened or created key. 
    
     
    
    Return Values
    
    If the function succeeds, the return value is ERROR_SUCCESS.
    If the function fails, the return value is a nonzero error code defined in WINERROR.H. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
    
    Remarks
    
    An application can use the RegCreateKey function to create several keys at once. For example, an application can create a subkey four levels deep at the same time as the three preceding subkeys by specifying a string of the following form for the lpSubKey parameter: 
    subkey1\subkey2\subkey3\subkey4
    The key identified by the hKey parameter must have been opened with KEY_CREATE_SUB_KEY access (KEY_WRITE access includes KEY_CREATE_SUB_KEY access). 
    
    If the lpSubKey parameter is the address of an empty string, the function opens and then passes back the key identified by the hKey parameter.
    TME

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •