在NSIS中,如果TaskbarPin插件不支持Windows 10及更高版本,你可以使用以下方法将程序固定到任务栏:

  1. 使用ShellExecute命令打开程序。

    Outfile "MyProgram.exe" ; 设置输出文件名
    Section
    ; ...
    ; 安装程序的其他操作
    ; ...
    ; 打开程序
    StrCpy $0 "open"
    StrCpy $1 "MyProgram.exe" ; 将MyProgram.exe替换为你的程序的路径和名称
    ShellExecute::exectosystem "$0" "$1"
    SectionEnd
    
  2. 使用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
      

请注意,以上代码示例仅供参考,你需要根据你的程序路径和名称进行相应的更改。此外,需要确保ShellExecuteRegistry插件已正确安装和导入

nsis中taskbarpin不支持windows10及更高版本那该怎么将程序固定到任务栏呢?

原文地址: http://www.cveoy.top/t/topic/idNb 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录