wxUpdCheckThread::LaunchUpdate() method extended

This commit is contained in:
Simon Rozman 2016-05-24 21:44:43 +02:00
parent bf28f7f55e
commit ff28695e80
3 changed files with 9 additions and 7 deletions

View File

@ -58,7 +58,7 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In
wxUpdCheckThread worker(locale.GetCanonicalName());
wxUpdCheckThread::wxResult res = worker.CheckForUpdate();
switch (res) {
case wxUpdCheckThread::wxUpdUpdateAvailable: return worker.LaunchUpdate() ? 0 : 1;
case wxUpdCheckThread::wxUpdUpdateAvailable: return worker.LaunchUpdate(NULL, true) ? 0 : 1;
case wxUpdCheckThread::wxUpdUpToDate : return 0;
default : return res;
}

View File

@ -127,11 +127,14 @@ public:
///
/// Launches update.
///
/// \param[in] hParent Handle of parent window
/// \param[in] headless Launch silent install
///
/// \returns
/// - true if launch succeeded
/// - false otherwise
///
bool LaunchUpdate();
bool LaunchUpdate(WXHWND hParent = NULL, bool headless = false);
protected:

View File

@ -470,12 +470,11 @@ bool wxUpdCheckThread::DownloadUpdatePackage()
}
bool wxUpdCheckThread::LaunchUpdate()
bool wxUpdCheckThread::LaunchUpdate(WXHWND hParent, bool headless)
{
wxLogStatus(_("Launching update..."));
// Headless Install
wxString param("/qn");
wxString param(headless ? wxT("/qn ") : wxEmptyString);
// Package
param += wxT("/i \"");
@ -490,7 +489,7 @@ bool wxUpdCheckThread::LaunchUpdate()
param += fileNameLog;
param += wxT("\"");
int result = (int)::ShellExecute(NULL, NULL, wxT("msiexec.exe"), param, NULL, SW_SHOWNORMAL);
int result = (int)::ShellExecute(hParent, NULL, wxT("msiexec.exe"), param, NULL, SW_SHOWNORMAL);
if (result > 32) {
wxLogStatus(_("msiexec.exe launch succeeded. For detailed information, see %s file."), fileNameLog.c_str());
return true;