#include "mainwidget.h" #include #include #include #include #include "../Util/Util.h" #include #include #include #include #include #include #include #include "QFontDatabase.h" #include "QTextCodec.h" #include "qfileinfo.h" #include #include #include #include "updatedlg.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); QSharedMemory shared_memory; shared_memory.setKey("mutex_homework_unhandle"); if (shared_memory.attach()) { shared_memory.lock(); *(char *)shared_memory.data() = 1; shared_memory.unlock(); QMessageBox::information(NULL, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("程序已经运行!")); return 0; } shared_memory.create(1); wstring strFilePath; GetModuleDir(strFilePath); strFilePath.append(L"index.db3"); QFile db_file(QString::fromStdWString(strFilePath)); db_file.open(QIODevice::ReadOnly); int _length = db_file.size(); db_file.close(); if (_length == 0) { QMessageBox::information(NULL, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("本地配置未生成,请开启监控程序后再试!")); return 0; } a.setWindowIcon(QIcon(":/CHJUnHandle/Resources/exe.ico")); MainWidget w; w.show(); return a.exec(); }