void CMFCAppMoveWindowApp::InitProfile()
{
    // CMyApp is derived from CWinApp.

    LPCWSTR pszKey = L"StudentInfo";
    LPCWSTR pszName = L"Julian";
    int iAge = 26;

    // Change the registry key under which our settings are stored.

    SetRegistryKey(_T("MyAppMoveWindowApp"));
    //HKEY_CURRENT_USER\Software\MyAppMoveWindowApp\MFCAppMoveWindow\StudentInfo

    // Write the information to the registry.

    WriteProfileString(pszKey, L"Name", pszName);
    WriteProfileInt(pszKey, L"Age", iAge);

    // Read the information from the registry.

    CString strName = GetProfileString(pszKey, L"Name");
    int iAge2 = GetProfileInt(pszKey, L"Age", 0);
}

在BOOL CMFCApp::InitInstance()中调用InitProfile()

相关文章:

  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2023-03-19
  • 2022-02-18
  • 2021-08-20
猜你喜欢
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
相关资源
相似解决方案