简体   繁体   English

如何使用nsis在我的设置中添加背景?

[英]How can I put a background in my setup with nsis?

I'm creating a setup.exe to my application and I'm using the nsis setup creator and I am compiling on ubuntu. 我正在为我的应用程序创建setup.exe ,并且正在使用nsis安装程序创建程序,并且正在ubuntu上进行编译。

Now I want customize the setup to appear with background image like this: 现在,我想自定义设置,使其与背景图像一起显示,如下所示:

nsis设置

How can I put a background in my setup with nsis ? 如何使用nsis在背景中添加背景?

Your picture is actually this one: http://www.graphical-installer.com/joomla/images/stories/gallery/projects/gallery-4.jpg 您的图片实际上就是这张照片: http : //www.graphical-installer.com/joomla/images/stories/gallery/projects/gallery-4.jpg

So you can use that software - Graphical Installer for NSIS - to achieve exactly the same effect without any effort or programming :) 因此,您可以使用该软件- 用于NSIS的图形安装程序 -无需付出任何努力或编程即可获得完全相同的效果:)

As author of that software I can say it is really easy to achieve such design: 作为该软件的作者,我可以说实现这样的设计确实很容易:

  1. Add custom control on installer UI (using ResHacker) - the better is to create new UI file so your previous installer will not be corrupted 在安装程序用户界面上添加自定义控件(使用ResHacker)-更好的方法是创建新的UI文件,这样您以前的安装程序就不会损坏
  2. Load image from file into control - use WinAPI calls or some NSIS wrapper. 将图像从文件加载到控件中-使用WinAPI调用或某些NSIS包装器。 Keep in mind the picture path must be somewhere on end-user's computer, eg $Temp. 请记住,图片路径必须位于最终用户计算机上的某个位置,例如$ Temp。

(the same as hypheni said but with more details) (与连字符相同,但有更多详细信息)

A clue would be, editing the required UI executable using Resource hacker and add a picture control on top of it. 一个提示是,使用Resource hacker编辑所需的UI可执行文件,并在其顶部添加图片控件。

You can find the available UI modules inside system path: C:\\Program Files\\NSIS\\Contrib\\UIs. 您可以在系统路径内找到可用的UI模块:C:\\ Program Files \\ NSIS \\ Contrib \\ UIs。

Then once you are done with your editing, define the custom UI using !define MUI_UI in your script and process accordingly. 然后,一旦完成编辑,请在脚本中使用!define MUI_UI定义自定义UI并进行相应处理。

For more details please refer to the below code snippet 有关更多详细信息,请参考下面的代码片段

Var hBitmap
!define MUI_CUSTOMFUNCTION_GUIINIT CustomGUIInit

Function CustomGUIInit
    InitPluginsDir
    ReserveFile `${BMP_HEAD}`
    File `/ONAME=$PLUGINSDIR\head.bmp` `${BMP_HEAD}`

    GetDlgItem $R1 $HWNDPARENT 1034
    System::Call `user32::LoadImage(i 0, t "$PLUGINSDIR\head.bmp", i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_LOADFROMFILE}) i.s`
    Pop $hBitmap
    SendMessage $R1 ${STM_SETIMAGE} ${IMAGE_BITMAP} $hBitmap
FunctionEnd

The above code is calling LoadImage Win32 API function from user32.dll and sets to windows control by SendMessage call. 上面的代码从user32.dll调用LoadImage Win32 API函数,并通过SendMessage调用设置为Windows控制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM