例子:利用nsdialogs在页面中创建ico与bmp图片
优质
小牛编辑
129浏览
2023-12-01
引用test.nsi的内容:
;利用nsdialogs在页面中创建ico与bmp图片 ;需要替换nsdialogs.nsh文件 !AddIncludeDir . !include nsDialogs.nsh Name nsDialogs OutFile nsDialogs.exe XPStyle on Page custom nsDialogsImage Page instfiles ;定义需要的变量 Var Dialog Var Image Var hImage Var Icon Var hIcon Function .onInit InitPluginsDir File /oname=$PLUGINSDIR\image.bmp "${NSISDIR}\Contrib\Graphics\Header\nsis-r.bmp" File /oname=$PLUGINSDIR\icon.ico "${NSISDIR}\Contrib\Graphics\Icons\arrow2-install.ico" FunctionEnd Function nsDialogsImage nsDialogs::Create /NOUNLOAD 1018 Pop $Dialog ${If} $Dialog == error Abort ${EndIf} ;插件图标 ${NSD_CreateIcon} 0 100 100% 100% "" Pop $Icon ${NSD_SetIcon} $Icon $PLUGINSDIR\icon.ico $hIcon ;创建bmp位图 ${NSD_CreateBitmap} 0 0 100% 100% "" Pop $Image ${NSD_SetImage} $Image $PLUGINSDIR\image.bmp $hImage nsDialogs::Show ;释放句柄 ${NSD_FreeImage} $hIcon ${NSD_FreeImage} $hImage FunctionEnd Section SectionEnd
另存附件。