谢谢!

解决方案 »

  1.   

    http://expert.csdn.net/Expert/topic/1138/1138439.xml?temp=.1155512
      

  2.   

    CString strDefaultPath;
    CString strTemp;
    TCHAR chTemp[MAX_PATH];strDefaultPath = "00";
    GetPrivateProfileString(_T("设置"),_T("路径"),strDefaultPath,chTemp,MAX_PATH,"c:\ad.ini");
    //chTemp就是xxx  (路径 = xxxx)
      

  3.   

    如果想在注册表中写值则不用注释SetRegistryKey()
      

  4.   

    .ini文件吗?用xxxxProfilexxxx()系列的API。
      

  5.   

    GetPrivateProfileString
    GetPrivateProfileInt
    SetPrivateProfileString
    SetPrivateProfileInt
      

  6.   

    The GetPrivateProfileString function retrieves a string from the specified section in an initialization file. Note  This function is provided only for compatibility with 16-bit Windows-based applications. Win32-based applications should store initialization information in the registry. DWORD GetPrivateProfileString(
      LPCTSTR lpAppName,        // section name
      LPCTSTR lpKeyName,        // key name
      LPCTSTR lpDefault,        // default string
      LPTSTR lpReturnedString,  // destination buffer
      DWORD nSize,              // size of destination buffer
      LPCTSTR lpFileName        // initialization file name
    );
    UINT GetPrivateProfileInt(
      LPCTSTR lpAppName,  // section name
      LPCTSTR lpKeyName,  // key name
      INT nDefault,       // return value if key name not found
      LPCTSTR lpFileName  // initialization file name
    );
    WritePrivateProfileString
    The WritePrivateProfileString function copies a string into the specified section of an initialization file. Note  This function is provided only for compatibility with 16-bit versions of Windows. Win32-based applications should store initialization information in the registry. BOOL WritePrivateProfileString(
      LPCTSTR lpAppName,  // section name
      LPCTSTR lpKeyName,  // key name
      LPCTSTR lpString,   // string to add
      LPCTSTR lpFileName  // initialization file
    );
      

  7.   

    注释掉SetRegistryKey,则程序把信息写在C:\windows\myproc.ini中.
      

  8.   

    See the link below, it contains several articles, FYI:http://www.codeproject.com/system/#Registry
      

  9.   

    在你的CSDN页面中,点击管理后,输入密码,给分
      

  10.   

    问题跟我最初想象得不太一样,我需要做一个共享的ini文件,现在我需要从ini文件中的每个section中的内容循环的读出来,但是我并不知道这个section下面有多少项,请问怎么做到呢?
      

  11.   

    hehe,我自己搞定了,多谢各位!我这就给大家分。