nsis中taskbarpin不支持windows10及更高版本那该怎么将程序固定到任务栏呢?
在NSIS中,如果TaskbarPin插件不支持Windows 10及更高版本,你可以使用以下方法将程序固定到任务栏:
-
使用
ShellExecute命令打开程序。Outfile "MyProgram.exe" ; 设置输出文件名 Section ; ... ; 安装程序的其他操作 ; ... ; 打开程序 StrCpy $0 "open" StrCpy $1 "MyProgram.exe" ; 将MyProgram.exe替换为你的程序的路径和名称 ShellExecute::exectosystem "$0" "$1" SectionEnd -
使用
Registry插件将程序添加到注册表。- 使用
WriteRegStr命令将程序路径添加到以下注册表位置:HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" - 使用
SendMessage命令发送TaskbarCreated消息给Explorer进程,以刷新任务栏。Function RefreshTaskbar FindWindow $0 "Shell_TrayWnd" "" $HWNDPARENT GetDlgItem $0 $0 0x130 SendMessage $0 0x1A FunctionEnd Section ; ... ; 安装程序的其他操作 ; ... ; 添加到注册表 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" "MyProgram" "MyProgram.exe" ; 刷新任务栏 Call RefreshTaskbar SectionEnd
- 使用
请注意,以上代码示例仅供参考,你需要根据你的程序路径和名称进行相应的更改。此外,需要确保ShellExecute和Registry插件已正确安装和导入
原文地址: http://www.cveoy.top/t/topic/idNb 著作权归作者所有。请勿转载和采集!