Lv.的博客

qt 添加本程序的注册表项

QStringcmd;
cmd.clear();
QStringapplication_path=QCoreApplication::applicationFilePath();//带文件扩展名的全路径
application_path.replace("/","\\");
QStringregPath="HKEY_CLASSES_ROOT\\software_name\\shell\\open\\command\\";
QSettings *programReg=new QSettings(regPath,QSettings::NativeFormat);
QVariantva=programReg->value(".");//"."=="Default"
if(!va.toString().contains(application_path,Qt::CaseInsensitive))
{
cmd="\""+application_path+"\""+"\"%1\"";
programReg->setValue(".",cmd);
delete programReg;
}
posted @ 2014-05-04 09:48  Avatarx  阅读(1062)  评论(0编辑  收藏  举报