2025-06-23 10:41:33 +08:00
|
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "qnetworkproxy.h"
|
|
|
|
#include <QApplication>
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <TlHelp32.h>
|
|
|
|
#include "psapi.h"
|
|
|
|
#include <Qmessagebox.h>
|
|
|
|
|
|
|
|
#include "easylogging++.h"
|
|
|
|
|
|
|
|
#define _CRTDBG_MAP_ALLOC
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <crtdbg.h>
|
|
|
|
|
|
|
|
bool isRunning(QString strName)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
PROCESSENTRY32 pe32;
|
|
|
|
pe32.dwSize = sizeof(pe32);
|
|
|
|
HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
|
|
|
if (hProcessSnap == INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
i += 0;
|
|
|
|
}
|
|
|
|
bool bMore = ::Process32First(hProcessSnap, &pe32);
|
|
|
|
LOG(INFO) << "find process...";
|
|
|
|
while (bMore)
|
|
|
|
{
|
2025-06-23 21:06:10 +08:00
|
|
|
QString strProcessName = QString::fromLocal8Bit(pe32.szExeFile);
|
2025-06-23 10:41:33 +08:00
|
|
|
// LOG(INFO) << strProcessName.toStdString();
|
|
|
|
if (strProcessName == strName)
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
LOG(INFO) << "find DPS.exe";
|
|
|
|
}
|
|
|
|
bMore = ::Process32Next(hProcessSnap, &pe32);
|
|
|
|
}
|
|
|
|
return (i > 1) ? true : false;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
QApplication a(argc, argv);
|
|
|
|
if (isRunning(a.applicationFilePath().split("/").last()))
|
|
|
|
{
|
2025-06-23 18:01:09 +08:00
|
|
|
//弹窗提示进程已存在,不能重复启动
|
|
|
|
QMessageBox::about(NULL, "错误", "请勿重复运行本程序");
|
2025-06-23 10:41:33 +08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
a.setWindowIcon(QIcon("icon1.ico"));
|
|
|
|
#ifdef DEVELOPENV
|
|
|
|
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
|
|
|
qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "8078");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
MainWindow w;
|
|
|
|
w.resize(1600, 900);
|
|
|
|
w.show();
|
|
|
|
return a.exec();
|
|
|
|
|
|
|
|
_CrtDumpMemoryLeaks();
|
|
|
|
}
|