本人现在想写一个扫雷程序,在BOOL CMineApp::InitInstance()函数中有以下代码:
         SetRegistryKey("CSER_513_2");
m_uXMineNum = GetProfileInt(GAME_SETTING, CUSTOM_XNUM, PRIMARY_XNUM);
m_uYMineNum = GetProfileInt(GAME_SETTING, CUSTOM_YNUM, PRIMARY_YNUM);其中m_uXMineNum 和 m_uYMineNum 都是 UINT 类型;
请问:
     SetRegistryKey("CSER_513_2");是什么意思,有什么作用?
     还有就是GetProfileInt()是什么意思?
请各位高手相助.谢谢.

解决方案 »

  1.   

    GetProfileIntThe GetProfileInt function retrieves an integer from a key in the specified section of the Win.ini file.Note  This function is provided only for compatibility with 16-bit Windows-based applications. Applications should store initialization information in the registry.
    UINT GetProfileInt(
      LPCTSTR lpAppName,
      LPCTSTR lpKeyName,
      INT nDefault
    );Parameters
    lpAppName 
    [in] Pointer to a null-terminated string that specifies the name of the section containing the key name. 
    lpKeyName 
    [in] Pointer to the null-terminated string specifying the name of the key whose value is to be retrieved. This value is in the form of a string; the GetProfileInt function converts the string into an integer and returns the integer. 
    nDefault 
    [in] Default value to return if the key name cannot be found in the initialization file.
      

  2.   

    CWinApp::SetRegistryKey
    Causes application settings to be stored in the registry instead of INI files.void SetRegistryKey(
       LPCTSTR lpszRegistryKey 
    );
    void SetRegistryKey(
       UINT nIDRegistryKey 
    );
    Parameters
    lpszRegistryKey 
    Pointer to a string containing the name of the key. 
    nIDRegistryKey 
    ID/index of a key in the registry
      

  3.   

    大哥,你能不能用中文再详细解释一遍,
    小弟的英文真的很烂
    尤其是SetRegistryKey这个函数有什么用处
      

  4.   

    UINT GetProfileInt(
      LPCTSTR lpAppName,
      LPCTSTR lpKeyName,
      INT nDefault
    );
    lpAppName--->包含键名的“文件夹”,字符串不能为空
    lpKeyName--->键名,字符串不能为空
    nDefault---》如果没有该键则返回该值,否则返回该键值
      

  5.   

    上面的在msdn里可以查到的啊 有没有源代码啊 一个简单的例子也好啊 只要能应用到这个函数就可以了
      

  6.   

    SetRegisterKey就是在注册表中建立一个键,你这里的键名是CSER_513_2,你可以用Regedit搜索一下找到就明白是什么意思了,另外还有一个作用就是使你以后调用WriteProfileInt之类的函数时是存储在注册表,而不是INI文件中
      

  7.   

    GetProfileInt那是INI文件里面用来得到文件的Setion  内容的啊
    看看MSDN  还有一个对应的是WriteProfileInt
    加油!