引用第7楼jdwx于2011-11-04 14:21发表的 :
那个功能是:自动文件关联
据我知道的Qt里没有,Qt的类太多了,到底有没有呢?
MFC倒是有这个功能,默认生成的框架就有。

这是应该安装程序做的工作,应用程序一般应该不会自己去做吧?
Windows下创建关联还是比较简单的:
比如我有一堆自定义的文件 .axb .axv .avf .avd ...
每个类别有不同的图标(分别使用 opeeeditor.exe 资源中的图标 1、2、3、4...)
所有均关联到一个 opeeeditor.exe 的程序
我的nsis脚本大致如下:
Section "Register FileType" Section1
;Register FileType
WriteRegStr HKCR ".axb" "" "OpeeAxialB.Document"
WriteRegStr HKCR ".axv" "" "OpeeAxialV.Document"
WriteRegStr HKCR "OpeeAxialB.Document" "" "OpeeAxialFile Document"
WriteRegStr HKCR "OpeeAxialB.Document\DefaultIcon" "" "$INSTDIR\opeeeditor.exe,1"
WriteRegStr HKCR "OpeeAxialV.Document" "" "OpeeAxialFile Document"
WriteRegStr HKCR "OpeeAxialV.Document\DefaultIcon" "" "$INSTDIR\opeeeditor.exe,2"
WriteRegStr HKCR "OpeeAxialB.Document\shell\open\command" "" '"$INSTDIR\opeeeditor.exe" "%1"'
WriteRegStr HKCR "OpeeAxialV.Document\shell\open\command" "" '"$INSTDIR\opeeeditor.exe" "%1"'
SectionEnd