Go Back   PackageDeploy Application Packaging Forums > Package Development > Application Packaging > Windows MSI

Reply
 
LinkBack Thread Tools Display Modes
Old 12-19-2008, 03:12 AM   #1 (permalink)
Zia
Guest
 
Posts: n/a
Default Execute MSI from an .exe

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
  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:03 PM.


vBulletin, Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
2007 - 2012 PackageDeploy.com