当前位置:网站首页>Qt应用程序防止多开,即单例运行
Qt应用程序防止多开,即单例运行
2022-07-24 10:32:00 【我啥都会】
static QSharedMemory *shareMem = new QSharedMemory("SingleApp"); //创建“SingleApp”的共享内存块
if (!shareMem->create(1))//创建大小1b的内存
{
QMessageBox::information(nullptr, "提示", "diaryTool程序已运行!");
qApp->quit(); //创建失败,说明已经有一个程序运行,退出当前程序
return -1;
}
边栏推荐
猜你喜欢

MySQL 数据库 JDBC编程

Implementation and traversal of binary tree and binary tree sorting tree

MySQL - lock

WEB安全基础 - - -文件上传(文件上传绕过)

MySQL - 唯一索引

Analysis of distributed lock redistribution principle

Golang migrate is easy to use

ffmpeg花屏解决(修改源码,丢弃不完整帧)

In depth analysis of common cross end technology stacks of app

常量指针、指针常量
随机推荐
划分数据1
常量指针、指针常量
协议圣经-谈端口和四元组
Implementation and traversal of binary tree and binary tree sorting tree
MySQL - 删除数据库表中的数据
fatal: unable to commit credential store: Device or resource busy
563页(30万字)智慧化工园区(一期)总体设计方案
Is it safe to open an online stock account?
pom文件dependency中的 scope用法
机器学习小试(11)验证码识别测试-使用Qt与Tensorflow2进行深度学习实验
2022: I feel like sleeping for the first time during the day
[correcting Hongming] what? I forgot to take the "math required course"!
Zoj1137+ operation 1 -- May 28, 2022
Differential restraint system -- 1 and 2 -- May 27, 2022
Binary original code, inverse code, complement code
Scan line, weight segment tree
MySQL - 普通索引
Arduino + AD9833 波形发生器
Binary search method
Scaffold document directory description and document exposure