为什么 MFC 要我设置注册表项?

Why does MFC want me to set a registry key?

当我在 Visual Studio 2010 年创建我的 MFC C++ 应用程序时,以下代码行被放置在我的主源文件中 InitInstance():

// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
SetRegistryKey(_T(""));

它说我应该将字符串修改为适当的内容,但我认为我从未使用过注册表项。使用 SetRegistryKey 有什么意义,我的程序的用户是否会看到该字符串?我应该删除这段代码吗?

这是样板代码,如果您使用注册表来 read/write 应用程序数据,则需要进行调整。

如果不使用注册表,可以删除此行。

CWinApp::SetRegistryKey:

Causes application settings to be stored in the registry instead of INI files.

....

This function sets m_pszRegistryKey, which is then used by the GetProfileInt, GetProfileString, WriteProfileInt, and WriteProfileString member functions of CWinApp. If this function has been called, the list of most recently-used (MRU) files is also stored in the registry. The registry key is usually the name of a company. It is stored in a key of the following form: HKEY_CURRENT_USER\Software\<company name>\<application name>\<section name>\<value name>.