[ol]Name "${PRODUCT_NAME}"
!define PRODUCT_NAME "EdgeWebView2"
OutFile "${PRODUCT_NAME}在线下载安装.exe"
!include "MUI2.nsh"
!include "x64.nsh"
!define MUI_PAGE_CUSTOMFUNCTION_PRE 'CopyFiles'
!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyInstFiles
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "SimpChinese"
VIProductVersion "1.0.0.0" ;版本号
VIAddVersionKey /LANG=2052 "ProductName" "顺艺${PRODUCT_NAME}部署程序" ;文件描述
VIAddVersionKey /LANG=2052 "Comments" "顺艺科技" ;备注
VIAddVersionKey /LANG=2052 "CompanyName" "www.jywangluo.cn"
VIAddVersionKey /LANG=2052 "LegalCopyright" "版权所有 (C) 顺艺科技" ;版权
VIAddVersionKey /LANG=2052 "FileDescription" "顺艺${PRODUCT_NAME}部署程序" ;产品名称
VIAddVersionKey /LANG=2052 "FileVersion" "1.0.0.0" ;文件版本
VIAddVersionKey /LANG=2052 "ProductVersion" "1.0.0.0" ;产品版本
VIAddVersionKey /LANG=2052 "OriginalFilename" "${PRODUCT_NAME}setup.exe" ;源文件名
Icon ${PRODUCT_NAME}.ico
ShowInstDetails nevershow
AutoCloseWindow true
BrandingText "东莞顺艺网络专用"
Caption "东莞顺艺网络"
Section "update" update
SetDetailsPrint textonly
DetailPrint "正在下载${PRODUCT_NAME}最新文件请稍后...."
setDetailsPrint listonly
${If} ${RunningX64}
NScurl::http GET "http://go.microsoft.com/fwlink/?LinkID=2124701" "$PLUGINSDIR\MicrosoftEdgeWebView2Runtime.exe"
${Else}
NScurl::http GET "http://go.microsoft.com/fwlink/?LinkID=2099617" "$PLUGINSDIR\MicrosoftEdgeWebView2Runtime.exe"
${EndIf}
SetDetailsPrint textonly
DetailPrint "正在安装${PRODUCT_NAME}最新文件请稍后...."
setDetailsPrint listonly
Execwait "$PLUGINSDIR\MicrosoftEdgeWebView2Runtime.exe /silent /install"
SetDetailsPrint textonly
DetailPrint "正在优化${PRODUCT_NAME}请稍后...."
setDetailsPrint listonly
ReadRegStr $R0 HKLM "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate" "edgeupdate_task_name_c"
ReadRegStr $R1 HKLM "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate" "edgeupdate_task_name_ua"
nsExec::Exec 'schtasks.exe /Delete /TN \$R0 /F'
nsExec::Exec 'schtasks.exe /Delete /TN \$R1 /F'
nsExec::Exec 'taskkill /im MicrosoftEdgeUpdate.exe /f '
nsExec::Exec 'taskkill /im msedge.exe /f '
nsExec::Exec 'sc.exe delete "edgeupdate"'
nsExec::Exec 'sc.exe delete "edgeupdatem"'
nsExec::Exec 'sc.exe delete "MicrosoftEdgeElevationService"'
RMDir /r "$PROGRAMFILES\Microsoft\EdgeUpdate"
SectionEnd
Function MyInstFiles
GetDlgItem $0 $HWNDPARENT 1 ;下一步
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 2 ;取消
ShowWindow $0 ${SW_HIDE}
GetDlgItem $1 $HWNDPARENT 3 ;上一步
ShowWindow $1 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1037
SendMessage $0 ${WM_SETTEXT} 0 "STR: "
GetDlgItem $0 $HWNDPARENT 1038
SendMessage $0 ${WM_SETTEXT} 0 "STR:东莞顺艺网络更新程序正在下载最新文件,请稍候...."
FunctionEnd
Function 'CopyFiles'
GetDlgItem $R0 $HWNDPARENT 1
System::Call 'user32::GetWindowLong(i $hwndparent,i -16)i.r0'
intop $1 0x80000 ~
intop $0 $0 & $1
System::Call 'user32::SetWindowLong(i $hwndparent,i -16,i $0)i'
FunctionEnd[/ol]复制代码

