From c80f45f70495b7112e80ed8fb4aa06c072a9edd9 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Thu, 6 Oct 2011 14:35:13 +0200 Subject: [PATCH] Use ShellExecute() to run the Uninstaller, because the Uninstaller now needs to be elevated (and thus QProcess can fail). --- src/Dialog_About.cpp | 2 +- src/Dialog_MainWindow.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index 7b76ba65..491f8db9 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -45,7 +45,7 @@ //Constants const char *AboutDialog::neroAacUrl = "http://www.nero.com/eng/technologies-aac-codec.html"; -const char *AboutDialog::disqueUrl = "http://www.youtube.com/watch_popup?v=yF6W-w0iAMM&vq=large"; +const char *AboutDialog::disqueUrl = "http://mulder.brhack.net/?player_url=yF6W-w0iAMM"; //http://www.youtube.com/watch_popup?v=yF6W-w0iAMM&vq=large //Contributors static const struct diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 92393112..0bd5e0d3 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -67,6 +67,7 @@ //System includes #include +#include //Helper macros #define ABORT_IF_BUSY if(m_banner->isVisible() || m_delayedFileTimer->isActive()) { MessageBeep(MB_ICONEXCLAMATION); return; } @@ -923,7 +924,18 @@ void MainWindow::windowShown(void) QApplication::processEvents(); PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC); QMessageBox::critical(this, tr("License Declined"), tr("You have declined the license. Consequently the application will exit now!"), tr("Goodbye!")); - if(!QProcess::startDetached(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath()), QStringList())) + QFileInfo uninstallerInfo = QFileInfo(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath())); + if(uninstallerInfo.exists()) + { + QString uninstallerDir = uninstallerInfo.canonicalPath(); + QString uninstallerPath = uninstallerInfo.canonicalFilePath(); + for(int i = 0; i < 3; i++) + { + HINSTANCE res = ShellExecuteW(this->winId(), L"open", QWCHAR(QDir::toNativeSeparators(uninstallerPath)), NULL, QWCHAR(QDir::toNativeSeparators(uninstallerDir)), SW_SHOWNORMAL); + if(reinterpret_cast(res) > 32) break; + } + } + else { MoveFileEx(QWCHAR(QDir::toNativeSeparators(QFileInfo(QApplication::applicationFilePath()).canonicalFilePath())), NULL, MOVEFILE_DELAY_UNTIL_REBOOT | MOVEFILE_REPLACE_EXISTING); }