Use ShellExecute() to run the Uninstaller, because the Uninstaller now needs to be elevated (and thus QProcess can fail).
This commit is contained in:
parent
682dbbc668
commit
c80f45f704
@ -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
|
||||
|
@ -67,6 +67,7 @@
|
||||
|
||||
//System includes
|
||||
#include <MMSystem.h>
|
||||
#include <ShellAPI.h>
|
||||
|
||||
//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<int>(res) > 32) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveFileEx(QWCHAR(QDir::toNativeSeparators(QFileInfo(QApplication::applicationFilePath()).canonicalFilePath())), NULL, MOVEFILE_DELAY_UNTIL_REBOOT | MOVEFILE_REPLACE_EXISTING);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user