我想写入几个键值为整数的键,怎么写呢?谢谢!

解决方案 »

  1.   

    SetRegistryKey(_T("AAA"));
    LoadStdProfileSettings(4);
      

  2.   

    /Load in the values from the registry
        CWinApp* pApp = AfxGetApp();
        CString sSection(_T("Settings"));
    m_nPort = pApp->GetProfileInt(sSection, _T("Port"), 25);
    m_sAddress = pApp->GetProfileString(sSection, _T("Address"));
    m_sHost = pApp->GetProfileString(sSection, _T("Host"));
    m_sName = pApp->GetProfileString(sSection, _T("Name"));
        m_Authenticate = (CSMTPConnection::LoginMethod) pApp->GetProfileInt(sSection, _T("Authenticate"), CSMTPConnection::NoLoginMethod);
        m_sUsername = pApp->GetProfileString(sSection, _T("Username"));
    m_sPassword = pApp->GetProfileString(sSection, _T("Password"));
        m_sEncodingFriendly = pApp->GetProfileString(sSection, _T("EncodingFriendly"), _T("Western European (ISO)"));
        m_sEncodingCharset = pApp->GetProfileString(sSection, _T("EncodingCharset"), _T("iso-8859-1"));
    m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
      

  3.   

    CWinApp* pApp = AfxGetApp();
        CString sSection(_T("Settings"));
    pApp->WriteProfileInt(sSection, _T("Port"), m_nPort);
    pApp->WriteProfileString(sSection, _T("Address"), m_sAddress);
    pApp->WriteProfileString(sSection, _T("Host"), m_sHost);
    pApp->WriteProfileString(sSection, _T("Name"), m_sName);
        pApp->WriteProfileInt(sSection, _T("Authenticate"), m_Authenticate);
        pApp->WriteProfileString(sSection, _T("Username"), m_sUsername);
    pApp->WriteProfileString(sSection, _T("Password"), m_sPassword);
        pApp->WriteProfileString(sSection, _T("EncodingFriendly"), m_sEncodingFriendly);
        pApp->WriteProfileString(sSection, _T("EncodingCharset"), m_sEncodingCharset);
      

  4.   

    我的dll中没App类呀。哪位给个用
    RegOpenKey
    RegCreateKey
    RegSetValue
    RegCloseKey
    操作的例子,只在初始化时读出一个键值,在结束时保存这个键值即可,谢谢!
      

  5.   

    RegOpenKey
    RegCreateKeyEx
    RegSetValueEx
    RegCloseKey
      

  6.   

    DWORD dwBufLen;
    LONG lRet=RegOpenKeyEx( HKEY_LOCAL_MACHINE,
    "Software\\RightFax\\Install",
    0, KEY_QUERY_VALUE, &hKey );
    if( lRet != ERROR_SUCCESS ){
    AfxMessageBox("Both the current directory and registry cannot find the faxrpt2.exe");
    exit(0);
    }
    RegQueryValueEx( hKey, "InstallDir", NULL, NULL,
    (LPBYTE) szProductType, &dwBufLen);
    RegCloseKey( hKey );