DPS/DataPlatform/main.cpp

66 lines
1.4 KiB
C++
Raw Normal View History

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)
{
QString strProcessName = QString::fromWCharArray(pe32.szExeFile);
// 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()))
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>
QMessageBox::about(NULL, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
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();
}