通过读注册表检测当前默认浏览器,读取路径及浏览器名称并判断是否运行调用杀掉进程。
测试环境:WInXP、WIn7、Win10 (IE、360、谷歌、QQ、搜狗、火狐)浏览器都读取有效。其它浏览器未测试。
代码来自:星空不寂寞
XPStyle on
Page instfiles
OutFile "Progid.exe"
Name "Progid"
Section
ReadRegStr $R0 HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" "Progid"
ReadRegStr $R2 HKLM "SOFTWARE\Classes\$R0\shell\open\command" ""
System::Call `shlwapi::PathRemoveArgs(tR2R2)`
System::Call "shlwapi::PathUnquoteSpaces(tR2R2)"
System::Call "shlwapi::PathRemoveFileSpec(tR2R3)"
System::Call "shlwapi::PathStripPath(tR2R2)"
MessageBox MB_ICONINFORMATION "当前默认浏览器名称:$R2 $\n$\n安装路径为:$R3"
killer::IsProcessRunning "$R2"
Pop $0
IntCmp $0 1 0 No
MessageBox MB_YESNO|MB_ICONQUESTION "检查到浏览器正在运行是否关闭进程?" IDNO +2
killer::KillProcess $0
No:
SectionEnd
评论 (0)