win7或者win8 64位里面有删除语言包的lpremove任务需要禁止
命令system("schtasks /change /disable /tn \\Microsoft\\Windows\\MUI\\LPRemove");禁止任务
// 检查操作系统的版本号
OSVERSIONINFO _osv;
ZeroMemory(&_osv, sizeof(OSVERSIONINFO));
_osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
::GetVersionEx(&_osv);
DWORD dw = _osv.dwMajorVersion;
DWORD dw2 = _osv.dwMinorVersion;
DWORD dw3 = _osv.dwOSVersionInfoSize;
DWORD dw4 = _osv.dwBuildNumber;
CString strr = _osv.szCSDVersion;
CString str;
str.Format("%d, %d, %d, %d", dw, dw2, dw3, dw4);
CString strDism;
CString strVersion = "";
strVersion.Format("%d.%d", dw, dw2);
//结束任务计划
system("schtasks /change /disable /tn \\Microsoft\\Windows\\MUI\\LPRemove");
if (IsWow64()) //64位
{
//strVersion = "64";
if (strVersion=="6.2") //win8
{
strFilePath = m_strAppPath + "\\lp-win8-64b.cab";
}
else if (strVersion=="6.1") //win7
{
strFilePath = m_strAppPath + "\\lp-win7-64b.cab";
}
CString cmdline = "dism /online /add-package /packagepath:" + strFilePath;
system(cmdline);
}
else
{
if (strVersion=="6.2") //win8
{
strFilePath = m_strAppPath + "\\win32\\lp-win8-32b.cab";
}
else if (strVersion=="6.1") //win7
{
strFilePath = m_strAppPath + "\\win32\\lp-win7-32b.cab";
}
CString cmdline = "dism /online /add-package /packagepath:" + strFilePath;
system(cmdline);
}
BOOL CHlsLangAnalyApp::IsWow64()
{
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process;
BOOL bIsWow64 = FALSE;
fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process");
if (NULL != fnIsWow64Process)
{
fnIsWow64Process(GetCurrentProcess(), &bIsWow64);
}
return bIsWow64;
}