当前位置:网站首页>Qt设置应用程序开机自启 解决设置失败原因
Qt设置应用程序开机自启 解决设置失败原因
2022-08-01 20:22:00 【源客V】
一、设置方法
QSettings reg("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
bool flag = true;
if (flag) {
//设置开机自启注册表
QString strAppPath = QDir::toNativeSeparators(QCoreApplication::applicationFilePath());
reg.setValue("exeName", strAppPath);
}
else {
//取消开机自启注册表
reg.remove("exeName");
}1.QDir::toNativeSeparators将路径的"/"替换为"\\"
1.使用QCoreApplication获取路径需要上述代码写在QApplication a(argc, argv);代码之后.
2."exeName"一般使用软件名称,也可以设置为其他文本.
二、查看设置是否成功
1.按下Win+R打开运行窗口,输入regedit,打开注册表编辑器

2.照"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"路径打开

看到下面有新添加的“exeName”配置项,路径正确,即成功。
边栏推荐
- Does LabVIEW really close the COM port using VISA Close?
- XSS靶场中级绕过
- myid file is missing
- 【社媒营销】如何知道自己的WhatsApp是否被屏蔽了?
- 外骨骼机器人(七):标准步态数据库
- 第60章 ApplicationPart自动集成整体性和独立性插件项
- 【多任务优化】DWA、DTP、Gradnorm(CVPR 2019、ECCV 2018、 ICML 2018)
- Oracle排序某个字段, 如果这个varchar2类型的字段有数字也有文字 , 怎么按照数字大小排序?
- 57:第五章:开发admin管理服务:10:开发【从MongoDB的GridFS中,获取文件,接口】;(从GridFS中,获取文件的SOP)(不使用MongoDB的服务,可以排除其自动加载类)
- 环境变量,进程地址空间
猜你喜欢

正则表达式

XSS靶场中级绕过

部署zabbix

Greenplum数据库源码分析——Standby Master操作工具分析

LTE time domain and frequency domain resources

nacos installation and configuration
![[Multi-task learning] Modeling Task Relationships in Multi-task Learning with Multi-gate Mixture-of-Experts KDD18](/img/f3/a8813759e5b4dd4b4132e65672fc3f.png)
[Multi-task learning] Modeling Task Relationships in Multi-task Learning with Multi-gate Mixture-of-Experts KDD18

图文详述Eureka的缓存机制/三级缓存

Interview assault 70: what is the glue bag and a bag?How to solve?

What is the difference between a utility model patent and an invention patent?Understand in seconds!
随机推荐
idea插件generateAllSetMethod一键生成set/get方法以及bean对象转换
Compose实战-实现一个带下拉加载更多功能的LazyColumn
【Untitled】
myid file is missing
The graphic details Eureka's caching mechanism/level 3 cache
算法---解码方法(Kotlin)
二维、三维、四维矩阵每个维度含义解释
[Personal work] Wireless network image transmission module
【多任务模型】Progressive Layered Extraction: A Novel Multi-Task Learning Model for Personalized(RecSys‘20)
【Dart】dart构造函数学习记录(含dart单例模式写法)
Win10, the middle mouse button cannot zoom in and out in proe/creo
[Multi-task optimization] DWA, DTP, Gradnorm (CVPR 2019, ECCV 2018, ICML 2018)
KDD2022 | 自监督超图Transformer推荐系统
Arthas 常用命令
WhatsApp group sending actual combat sharing - WhatsApp Business API account
通配符 SSL/TLS 证书
油猴hook小脚本
To promote energy conservation institute 】 【 the opinions of the agricultural water price reform
数据可视化
【多任务优化】DWA、DTP、Gradnorm(CVPR 2019、ECCV 2018、 ICML 2018)