我在 HKEY_LOCAL_MACHINE SOFTWARE\Company\Company\ 中创建名为“Language”的 regedit 键,将在 Visual Studio 调试模式下创建,但我通过 Install shield 构建它,并将其安装在其他机器和操作系统(windows 7 窗口 8)中,密钥不能由应用程序创建。
在安装屏蔽步骤时,我创建了 SOFTWARE\Company\Company\ 的 Regedit 键,但我无法在此代码处更改语言的键
SetMainRegeditValue(theApp.mMainRegKey, theApp.mMainRegNormal[0], theApp.g_eLanguage);
这段代码会发生什么?
// In the global
CRegKey mMainRegKey;
CString *mMainRegPath;
CString *mMainRegNormal;
....
theApp.mMainRegPath = new CString[1];
theApp.mMainRegPath[0] = _T("SOFTWARE\\Company\\Company\\");
theApp.mMainRegNormal = new CString[1];
theApp.mMainRegNormal[0] = _T("Language");
// Check Regedit value
if(theApp.mMainRegKey.Open(HKEY_LOCAL_MACHINE, theApp.mMainRegPath[0]) == ERROR_SUCCESS)
{
TCHAR tstrLan[_MAX_PATH];
DWORD len = _MAX_PATH;
DWORD lanlen = 8;
if(theApp.mMainRegKey.QueryStringValue(_T("Version"),tstrLan, &lanlen) != ERROR_SUCCESS)
{
RegDeleteKey(HKEY_LOCAL_MACHINE, theApp.mMainRegPath[0]);
RegDeleteKey(HKEY_LOCAL_MACHINE, theApp.mMainRegNormal[0]);
SetMainRegeditValue(theApp.mMainRegKey,_T("Version"), _T("v2.0.0"));
}
}
if(theApp.mMainRegKey.Open(HKEY_LOCAL_MACHINE,theApp.mMainRegPath[0]) != ERROR_SUCCESS)
{
theApp.mMainRegKey.Create(HKEY_LOCAL_MACHINE, theApp.mMainRegPath[0]);
SetMainRegeditValue(theApp.mMainRegKey, theApp.mMainRegNormal[0], theApp.g_eLanguage);
}