举个例子……

解决方案 »

  1.   

    HKEY hKey;
    LONG lRet;
    if(RegCreateKeyEx(HKEY_CURRENT_USER,
    TEXT("SOFTWARE\\TEST"),
    0,
    "",
    0,KEY_WRITE,NULL,
    &hKey,0) == ERROR_SUCCESS) 
    {
    lRet = RegSetValueEx(hKey,
    TEXT("CardType"),
    NULL,
    REG_SZ,
    (LPBYTE)strText,
    strlen(strText)+1);
    if(lRet != ERROR_SUCCESS)
    {
    RegCloseKey(hKey);
    return 0;
    }
    }
      

  2.   

    CWinApp::SetRegistryKeyvoid SetRegistryKey(
       LPCTSTR lpszRegistryKey 
    );
    void SetRegistryKey(
       UINT nIDRegistryKey 
    );
    格式:
    HKEY_CURRENT_USER\Software\<company name>\<application name>\<section name>\<value name>.
      

  3.   

    DWORD dwDisposition;
    HKEY hkSub = NULL;RegCreateKeyEx(HKEY_CURRENT_USER, "mykey", 0, "", 0, 
            KEY_READ | KEY_WRITE, 0, &hkSub, &dwDisposition);