- NSIS Discussion
- Display Animated GIF images for Custom Pages
Archive: Display Animated GIF images for Custom Pages
baskaran.vishnu
3rd May 2006 12:03 UTC
Display Animated GIF images for Custom Pages
Hi,
I am having difficulties to display an animated GIF Image for a custom page,
At the moment, based on the design of my custom page, clicking the Next Button installs a hidden based application. During that process, I would like to show to an Animated GIF indicating installation in progress.
I am currently using a Bannner Image using the EBanner plugins. The banner works excellent. However, this plugin does not support animated GIFs.
I have tried using another plugin, AnimGif, however, I am having difficulties running this plugin for my custom page.
I would be grateful for any advice or references on this issue.
Thank you
zeeh3
4th May 2006 02:02 UTC
Attach your script.
baskaran.vishnu
4th May 2006 10:18 UTC
Attached Scripts
Hi,
I have posted the Scripts as shown below;
/* Start Scripts */
/*Initialized code for the custom page at the beginning of the scripts */
#Custom Page Intialization
Page custom ShowMSQLCheckPage CheckMSQLPage
# Extract the Custom INI file
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "DispForms\Check MSQL.ini" "CheckMSQL"
/* Initialize a GIF image to the Plugins Directory */
Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\sample.gif "C:\sample.gif"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "DispForms\Check MSQL.ini" "CheckMSQL"
FunctionEnd
/* Custom Page Functions */
Function ShowMSQLCheckPage
# Display the page.
!insertmacro
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "CheckMSQL"
Pop $R0 # HWND
GetDlgItem $R1 $R0 1200 ; 1200 + Field # - 1
GetDlgItem $R2 $R0 1201 ; 1200 + Field # - 1
SetCtlColors $R0 3D66AB 3D66AB
SetCtlColors $R1 FFFFFF 3D66AB
SetCtlColors $R2 FFFFFF 3D66AB
!insertmacro MUI_INSTALLOPTIONS_SHOW
continue:
Return
FunctionEnd
Function CheckMSQLPage
newadvsplash::show /NOUNLOAD 2000 600 400 -1 /BANNER /NOCANCEL "$PLUGINSDIR\sample.gif"
newadvsplash::hwnd /NOUNLOAD
Pop $0
AnimGif::play /NOUNLOAD /hwnd=$0 /bgcol=0xffffff "$PLUGINSDIR\sample.gif"
sleep 5000
newadvsplash::wait ; waits or exits immediately if 'show' already finished
newadvsplash::stop
AnimGif::stop
FunctionEnd
/* End of Scripts */
From the codes above, the custom page calls on two functions to show the Main page(With some Text Display from the custom ini file) followed by the action to show the animated GIF Image when user clicks on the 'Next' button of the custom page. I can't seem to get the GIF Image displayed based on this condition. In fact the Installer hangs and I have to forcefully exit the Installer.exe file.
The weird thing is that when I remove '/Banner' from the newadvsplash::show command line, the Flash Image is displayed but the GIF Image does not seem to show its animation movement. It seems as if the AnimGif::play command doesn't execute.
Besides that, if I execute the newadvsplash::show (with '/Banner'),newadvsplash::hwnd and AnimGif::play commands in Function .onInit, the Animated Image with its splash screen feature is displayed during startup of the Installer.exe. It's as if that these functions work in the Function .oninit but not in custom based functions
I am using the AnimGif.dll along with the newadvsplash.dll plugins to run this method.
Would appreciate any help on this.
Thanks
(PS: I have attached the sample.gif Animated Image as a reference)
baskaran.vishnu
5th May 2006 08:56 UTC
Hi,
If you need any added details based on the scripts above, please inform me. I would help in any way possible.
I would truly appreciate it if anyone could assist me with the problem above.
Thanks
Takhir
14th May 2006 11:17 UTC
newadvsplash patch
Please test attached dll version.
hbatista
3rd April 2007 18:49 UTC
Hi, reviving this old thread...
I'm also trying to use the newadvsplash plugin to display animated GIF banners when navigating between pages, i.e. pressing the 'Next' button displays an animated 'please wait' banner, and the next page hides the banner.
The plugin version that's on the wiki didn't work, but the special version in the last reply does work!
But... there's still a problem... it only works the first time! Any second calls to newadvsplash::show freeze the installer.
Please help...
Thanks
Takhir
3rd April 2007 20:05 UTC
Not freezes in my tests using May 14, 2006 version. Script attached. I'll compare sources and add lost&found version to wiki tomorrow :)
hbatista
4th April 2007 10:17 UTC
Thanks Takhir, I tried your script and it does indeed work.
But in attachment is a little example I cooked up that has the freezing problem.
It has two InstallOptions pages, and simulates a slow operation at the beginning of them where I'd like to show a banner, on the first page it works, on the second it freezes.
Can you take a look at it?
Thank you very much for your help!
Takhir
4th April 2007 12:53 UTC
SetPluginUnload manual
helped me in your test. Is alwaysoff a default? But this is my fault too.. AnimGif not makes a full clean up on serial 'show' requests, and may hang. This is why I used 'stop' with unload.
hbatista
4th April 2007 14:57 UTC
Tried using 'SetPluginUnload manual' but still no luck here ('manual' is the default anyway) :(
I'm using stop with unload too, but it doesn't seem to help...
Takhir
4th April 2007 15:07 UTC
script and binaries attatched - opens second page and second gif. I put new version to wiki but it has a minimum changes compare to version linked above.
hbatista
4th April 2007 16:08 UTC
OK, I see now what causes it to freeze, SetPluginUnload has nothing to do with it, your version worked because you changed the 'delay' value from 120000 to 1200 ms.
It appears the plugin does not like to have 'stop' called before the delay value expires.
I have to use a big value because I just want the banner to show for as much time as is necessary, not just a fixed delay...
Thanks for your patience
ps: by the way, the new version you uploaded to the wiki appears to be the same as the old one...
hbatista
4th April 2007 18:28 UTC
Got it working!
Fiddled a bit with the source code, the wiki version does not seem to be the most recent (e.g. it doesn't have the '/BANNER' parsing code), but modified it anyway.
The problem seems to be that because the thread never ended ('stop' doesn't wait), it never unregistered the window class. So on the second call to 'show', the register failed. I added an unregister in the 'stop' method and the thing is now working.
In attach there's the modified source, modified lines have an '//hbatista' comment. Takhir, can you integrate this into the official plugin version?
Thanks
Takhir
5th April 2007 07:38 UTC
Thanks for your help, hbatista!
RegisterClass really works in the application scope, not dll load/unload :). I added your code to wiki.
Few comments.
1. /BANNER mode presents in code beginning 06-25-2005, may be if-else parsing looks a bit ugly, but it works - sets modal = false.
2. 04-04-2007 wiki version sets hParent=NULL for banner mode only, I guess this is a corect way.
Please test wiki version. Just for possible proxy issues - latest files in zip should have Apr. 5 date.
And thank you again!
hbatista
5th April 2007 09:33 UTC
Thanks Takhir,
for some reason when I click the most recent version of the wiki file, the zip I get has files with date 2006-03-04...
when clicking the revisions I get the expected file dates.
Will try later, maybe it's some cache thing?...
hbatista
5th April 2007 10:24 UTC
Duh... browser cache... :)
Tried it, it's working fine!
Thanks again!
zbd
18th July 2007 02:57 UTC
I'm having some trouble using the AnimGif plugin.
I've managed to get the image onto my custom page, however, it isn't displaying properly, it kind of flashes bits here and there.
Has anyone else experienced this?
I've tried a couple of different gifs.
I've also tried a few versions of the plugin.
Here's some of the code I'm using.
AnimGif::play /NOUNLOAD /VALIGN=CENTER /HWND=$HWNDPARENT "$EXEDIR\sample.gif"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "searching"
Sleep 2000
Sleep 2000
AnimGif::stop ; terminates all
Sleep 1000
If I'm doing everything else properly, it may be that i'm using a WANSIS skin, it may be causing some problems.
Any pointers much appreciated.