#ifdef Q_OS_UNIX
#elif defined Q_OS_MAC
QString filename
= "MyApp.dmg";
// I'm not sure, I not using Mac Os #else
#endif
#ifdef Q_OS_WIN
return QProcess::startDetached(filename
);
//... Windows 2000, XP } else { // Windows Vista, 7, 8
int result = (int)::ShellExecuteA(0, "open", filename.toUtf8().constData(), 0, 0, SW_SHOWNORMAL);
if (SE_ERR_ACCESSDENIED == result)
{
return (int)::ShellExecuteA(0, "runas", filename.toUtf8().constData(), 0, 0, SW_SHOWNORMAL) > 32;
}else {
qDebug() << "Problem with run application";
}
return result > 32;
}
#else
return QProcess::startDetached(filename
);
//Linux, Mac #endif
#ifdef Q_OS_UNIX
QString filename = "./MyApp";
#elif defined Q_OS_MAC
QString filename = "MyApp.dmg"; // I'm not sure, I not using Mac Os
#else
QString filename = "MyApp.exe";
#endif
#ifdef Q_OS_WIN
if(QSysInfo::windowsVersion() < QSysInfo::WV_VISTA) {
return QProcess::startDetached(filename); //... Windows 2000, XP
} else { // Windows Vista, 7, 8
int result = (int)::ShellExecuteA(0, "open", filename.toUtf8().constData(), 0, 0, SW_SHOWNORMAL);
if (SE_ERR_ACCESSDENIED == result)
{
return (int)::ShellExecuteA(0, "runas", filename.toUtf8().constData(), 0, 0, SW_SHOWNORMAL) > 32;
}else {
qDebug() << "Problem with run application";
}
return result > 32;
}
#else
return QProcess::startDetached(filename); //Linux, Mac
#endif
To copy to clipboard, switch view to plain text mode
Bookmarks