mirror of
https://github.com/tnodir/fort
synced 2024-11-15 03:26:01 +00:00
Installer: Add global mutex to find running instance.
This commit is contained in:
parent
85fd86c1cb
commit
51e7fc4d2c
@ -9,6 +9,7 @@
|
||||
; NOTE: The value of AppId uniquely identifies this application.
|
||||
; Do not use the same AppId value in installers for other applications.
|
||||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||
AppMutex={#APP_NAME}
|
||||
AppName={#APP_NAME}
|
||||
AppVersion={#APP_VERSION_STR}
|
||||
AppVerName={#APP_NAME}
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "fortcommon.h"
|
||||
|
||||
#define _WIN32_WINNT 0x0600
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
|
@ -5,9 +5,12 @@
|
||||
#include "fortcommon.h"
|
||||
#include "fortmanager.h"
|
||||
#include "fortsettings.h"
|
||||
#include "util/osutil.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
OsUtil::createGlobalMutex(APP_NAME);
|
||||
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
@ -5,6 +5,9 @@
|
||||
#include <QPixmap>
|
||||
#include <QImage>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#include "processinfo.h"
|
||||
|
||||
OsUtil::OsUtil(QObject *parent) :
|
||||
@ -33,3 +36,8 @@ QString OsUtil::pidToDosPath(quint32 pid)
|
||||
const ProcessInfo pi(pid);
|
||||
return pi.dosPath();
|
||||
}
|
||||
|
||||
bool OsUtil::createGlobalMutex(const char *name)
|
||||
{
|
||||
return !CreateMutexA(NULL, FALSE, name);
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ public:
|
||||
Q_INVOKABLE static void setClipboardData(const QVariant &data);
|
||||
|
||||
Q_INVOKABLE static QString pidToDosPath(quint32 pid);
|
||||
|
||||
static bool createGlobalMutex(const char *name);
|
||||
};
|
||||
|
||||
#endif // OSUTIL_H
|
||||
|
Loading…
Reference in New Issue
Block a user