- NSIS Discussion
- Need help with BGImage
Archive: Need help with BGImage
Tolwyn
24th April 2003 22:17 UTC
Need help with BGImage
The example is fine, but I don't know how to actually utilize this for a script that is NOT an example.
The script snippet I'm using is:
;--------------------------------
;BGIMAGE
Section
# the plugins dir is automatically deleted when the installer exits
InitPluginsDir
File /oname=$PLUGINSDIR\bgimage.bmp "c:\foo\bgimage.bmp"
BgImage::Init /NOUNLOAD /FILLSCREEN $PLUGINSDIR\bgimage.bmp
BgImage::Destroy
SectionEnd
;--------------------------------
Of course, compiling this with a working script does not produce the BGImage. It'd be great if more information were present. Building this from following the instructions exactly in the readme does not work, either.
kichik
24th April 2003 22:27 UTC
You should initialize it when you want it to show (.onGUIInit for example) and destroy it when you want to stop showing it (.onInstSuccess/Fail which currently does not work for a very weird and unknown reason - destroy it at the end of the last section, or a hidden section). The example shows it longer than the second it flashes on your screen because it pops a few message boxes that stalls the code execution and thus "avoids" the destroy function for as long as you don't dismiss the message boxes.
Joost Verburg
24th April 2003 22:28 UTC
Put it in the .onInit function.
edit: that should be .onGUIInit
kichik
24th April 2003 22:29 UTC
Don't put it in .onInit. As the readme states:
Do not use in .onInit!
Joost Verburg
24th April 2003 22:30 UTC
Yeah that's true. I mean not a init & destroy right after each other in a section :D
Tolwyn
24th April 2003 22:33 UTC
See... this is the kind of thing that bothers me.
There's no way I would have known any of that information.
The instructions explicitly state:
SetImage [/FILLSCREEN] path_to_bitmap
Sets a new image to the current timage window
Use /FILLSCREEN to make the image fill the screen
Do not use in .onInit!
So, I still don't understand how to get this to work, I'm sorry. I'm sorry I'm expected to understand every little detail about this program! :rolleyes:
So, I'm confused.
The most frustrating thing about this is that there are no real examples. Everyone just showcases their little feature, but only tells 20% of the whole story.
Tolwyn
24th April 2003 22:36 UTC
So what do I need to do, explicitly, to get the bgimage to display when they double click the EXE, and to go away when it's finished installing?
I'm looking for actual syntax here.
Tolwyn
24th April 2003 22:43 UTC
I give up on this "feature."
Since the instructions put this whole thing into a section, I can't put a function inside a section. Trying to create a function .onGUIInit yields this error:
Error: Function named ".onGUIInit" already exists.
Error in macro MUI_FUNCTIONS_GUIINIT on macroline 6
Error in macro MUI_BASIC on macroline 8
Error in macro MUI_SYSTEM on macroline 16
Error in macro MUI_LANGUAGEFILE_BEGIN on macroline 7
!include: error in script: "C:\Program Files\NSIS\Contrib\Modern UI\Language files\English.nsh" on line 9
Error in macro MUI_LANGUAGE on macroline 6
Error in script "C:\Tolwyn\build\7jg77_current.nsi" on line 87 -- aborting creation process
Joost Verburg
24th April 2003 22:50 UTC
You should first understand the basics of a NSIS script. What a function, a callback function, a section etc. is. There is a good tutorial in the documentation.
Joost Verburg
24th April 2003 22:51 UTC
If you are using the Modern UI, you should define a custom function, because the Modern UI inserts this function.
A copy from the documentation:
!define MUI_CUSTOMFUNCTION_ONGUIINIT myGuiInit
Function myGUIInit
...your own code...
FunctionEnd
Tolwyn
24th April 2003 22:58 UTC
Thanks, Joost.
That's part of the problem, though.
I do understand the basics of NSIS Script editing. I would say that I have an AVERAGE working knowledge.
I think you may be too close to the documentation to have a real objective eye on how utterly futile some of it is. It takes a concept, and simply just redfines it; or in another way, states what the concept is, not really what it's for, what it does, and how to use it.
It's extremely confusing.
Joost Verburg
24th April 2003 23:28 UTC
I do understand your problem. But we simply don't have enough time to write more turorials, examples etc. It's already a lot of work to maintain the current documentation.
We are still looking for more people who want to help writing turorials and stuff.
Tolwyn
24th April 2003 23:36 UTC
Ok. I did what you said. Toward the top of my script, I have:
!define MUI_CUSTOMFUNCTION_ONGUIINIT myGuiInit
Then I have:
;BGIMAGE
Function myGuiInit
# the plugins dir is automatically deleted when the installer exits
InitPluginsDir
File /oname=$PLUGINSDIR\bgimage.bmp "c:\foo\bgimage.bmp"
BgImage::Init /NOUNLOAD /FILLSCREEN $PLUGINSDIR\bgimage.bmp
FunctionEnd
Then I have:
Function .onInstSuccess
BgImage::Destroy
FunctionEnd
Function .onInstFail
BgImage::Destroy
FunctionEnd
When compiling the script, I get:
2 warnings:
install function "myGuiInit" not referenced - zeroing code (14-23) out
install function ".onInstFail" not referenced - zeroing code (29-33) out
virtlink
25th April 2003 09:53 UTC
Function .onInstSuccess
BgImage::Destroy
FunctionEnd
Function .onInstFailed
BgImage::Destroy
FunctionEnd
And, did you use the defines BEFORE the MUI_LANGUAGE macro's:?
Modern UI Documentation
Add the defines before the MUI_LANGUAGE macro's.
Joost Verburg
25th April 2003 12:54 UTC
Yep, should be the order of commands.
The Readme explains the right order. All defines should be before the MUI_LANGUAGE macro's.
kichik
25th April 2003 14:40 UTC
(.onInstSuccess/Fail which currently does not work for a very weird and unknown reason - destroy it at the end of the last section, or a hidden section)
Do NOT use it in .onInstSuccess/Failed. Destroy BgImage at the end of the last section as the example does.
Tolwyn
25th April 2003 16:51 UTC
Ok. I'll keep hacking (literally) away at it.
I feel I'm closer now. Thanks for all the help and putting up with my exasperation.