|
|
#1 (permalink) |
|
Guest
Posts: n/a
|
Hi all!
I am calling a MSI from an EXE using MFC dialog application. I am working on Windows-XP(SP2) using, IDE is Visual Studio 6.0. If same version of product has found on user's machine then MSI displays a msgbox "Another version of this product is already installed.". But, in my case, this msgbox does not get displayed and dialog is waiting for response, plz see the CODE below: ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- CString strPath = ((CXAStartApp *)AfxGetApp())->GetAppPath(); CString strSetupPath = strPath + "\\Setup*.msi"; CFileFind finder; if (finder.FindFile(strSetupPath)) { finder.FindNextFile(); strSetupPath = finder.GetFilePath(); STARTUPINFO StartupInfo = {0}; PROCESS_INFORMATION ProcessInfo = {0}; StartupInfo.cb = sizeof(STARTUPINFO); StartupInfo.dwFlags = STARTF_USESHOWWINDOW; StartupInfo.wShowWindow = SW_HIDE; char szSysPath[MAX_PATH]; GetSystemDirectory(szSysPath, MAX_PATH); CString strExeName = szSysPath; strExeName += "\\msiexec.exe"; CString strCmdLine = "msiexec /i \""; strCmdLine += strSetupPath; strCmdLine += "\""; char szCmdLine[MAX_PATH]; strcpy(szCmdLine, (LPCTSTR)strCmdLine); BOOL retvalue = CreateProcess(strExeName, szCmdLine, NULL, NULL, FALSE, 0, NULL, strPath, &StartupInfo, &ProcessInfo); HANDLE hProcess = ProcessInfo.hProcess; Sleep(1000); while(1) { if(WaitForSingleObject(hProcess, 1250) == WAIT_OBJECT_0) break; } } OnOK(); ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Plz help me to sort the problem. Thanks in advance. Regards, Zia |
|