If the application is first opened, and then double-click the file to how to pass the information of the file to process? Which the great spirit guide, thank you!
Is the realization of the code below:
//registry associated files
QString strRegeditPath="HKEY_CURRENT_USER \ \ Software \ \ Classes";
QString className="km. KTF";
QString appPath=QApplication: : applicationFilePath ();
AppPath. Replace ('/', '\' \ ');
QString extName=". KTF ";
QString extDesName="KTF file";
QSettings setting (strRegeditPath, QSettings: : NativeFormat);
//whether the registry already exists
QString qsValue=https://bbs.csdn.net/topics/setting.value ("/" + className + "/", true). The toString ();
if (! QsValue. IsEmpty ()) {
QDebug () & lt; <" QsValue="https://bbs.csdn.net/topics/
}
//in... Classes under the category to create a new category, and set up the call parameters of the category to open the file
Setting. SetValue ("/" + className + "/Shell/Open/Command/.", "" "+ appPath +" \ "" % 1 \ "");
//file type description
Setting. SetValue ("/" + className + "/", extDesName);
//set the default icon of the class the default icon
Setting. SetValue ("/" + className + "/DefaultIcon/.", appPath +, "0");
//associated ext and categories
Setting. SetValue ("/" + extName +/OpenWithProgIds "/" + className, "");
//save the modified immediately
Setting. The sync ();
CodePudding user response:
Simple method is: use the Shared memory, the memory set in the identification, read the logo can judge whether the program has been running,CodePudding user response: