Archive: On my travels...


On my travels...
I have been playing around with the UI exes with resource hacker and I have noticed some (I call them features) bugs relating to the verify dialog. If you add a title bar, the dialog shows up on the instfiles page when the percent comes up (if you don't use solid compression the dialog pops up for each command).

And a request. To have a .onverify function so you can maipulate the verify dialog after the crc check has been done. So you can set the text on the label to show different actions being done. And when the function ends, the dialog disappears.

I hope this is implemented (it probably won't) but I thought I would try.


It probably appeared because you've set the WS_VISIBLE flag to the dialog. The dialog is almost always created, but the default is being invisible. When you've added WS_VISIBLE, it also showed up when it was created.

.onVerify, as you've requested, can not be added. When the CRC verification dialog shows, the code has not yet been unpacked. It is also unverified. You can use the Banner plug-in which shows the verification dialog with custom text.


Thanks for that. I will check it out. I also forgot to mention this. If a function is not used, the code in the function is zeroed, right? How about the same for unused macros?


If a macro is not used, it's not used. Its code will not be compiled.


Also for BgGradient if you could have an extra optional field to specify if the gradient is in a dialog in the background. I am currently working on a dll for my UI that has this in it (text with a drop shadow but no gradient). This would be nice for the next version.
I have also gone back to using 2.07 - I will upgrade as soon as 2.1 is released. Oh and I have upgraded to XP Professional and it's great. No more computer slowdowns.


You can simply specify the same color for both the starting and ending color. This way, no gradient will appear.


What I meant by BgGradient in a dialog was... well... see the attached picture.

Now all that's needed is a black drop shadow for the text.


Doh! Forgot to add it.


You can create the drop shadow yourself by adding the same text offset a couple of pixels to the right and bottom before adding the text.
Other than that I don't understand what you mean by:

an extra optional field to specify if the gradient is in a dialog in the background

an extra optional field to specify if the gradient is in a dialog in the background
See the bitmap? I have added a title and a frame around the border of the bitmap. I added the title and the frame manually to show what I wanted in the next version (or my dll).

Example:

BgGradient 000000 0000FF FFFFFF "Text" /SHOWFRAME /SHOWDROP

/SHOWFRAME is for showing the title and frame around the gradient (optional).
/SHOWDROP would be for showing a shadow behind the text (optional).

Hopefully now you know what I mean.

Well then, you need to add an additional field for the dropshadow color.
What if the user specified black text? Or if the gradient colors are black and black?


I didn't relise you were talking about the source in nsis, I thought it was in the dll (duh). Anyway, I got the window to appear in my dll in the weekend. The window would not appear for a long time and kept giving me a fatal error when I ran the dll in a sample nsis installer. Then I relised I forgot the /nounload switch when calling the dll. I kept thinking my programming was bad. Oh well, I will have a look at the source and see what I can do.


Well, I have adapted the code from the BgImage plugin and got what I needed, but there is no title or proper icon showing in the titlebar. I tried using different icons and default windows icons but that didn't work. I tried adding the caption in the source code but that caused the plugin to not show at all. I tried adding the caption manually though a test script but that did not work either. The window also shows in the taskbar (I don't want it to). I made a basic plugin that displays a dialog template and nsis automatically adds the icon to it. And the caption appears as well.

I have attached a zip of the modified BgImage source code. I suggest copying a source distribution, copy the bgimage.cpp to the source and compile using scons (if you want to have a go at fixing this problem).


My Plugin Demo


Ok, a few questions:

1.
I have thought of an idea for the unload plugins flag. Currently the plugin unloading has two options:
manual or alwaysoff.
I was thinking of adding a 'force' option. This option is basicly the same as the alwaysoff option but when calling a dll function you can have the /FORCEUNLOAD parameter on it to force it to unload.

2.
How about an extra parameter on the page command? Example:
page instfiles [pre] [show] [leave] [rect]
where rect is the custom dialog control to display the page in (the default is 1018. I would like to be able to change it so I can have pages displayed in different locations in the window - this will help in my InstallSpider UI).

3.
Is there any way to get the info off the instfiles page and use it in my own custom (dll made) instfiles page?

4.
I can't set the icon on my background window. If I use a dialog template it appears but the dialog has no border and has a space at the top (presumably where the menu would have gone). I have tried setting it in my dll and nsis but nothing works (I just thought of another possibility - I will reply when I have tried it). Currently I am using no icon (no WS_SYSMENU in the window config).

And now for a magic trick. If you add this line to your installer:
caption "$(^SetupCaption)"
your installer will not run at all! (this is a bug). This line works:
caption "$(^Name) Setup)".
I have not tried this in the lastest versions of NSIS (still using 2.07).

Cheers, Jason.


  1. Why would you ever want to forcibly unload a plug-in that way? Calling FreeLibrary more times than you've called LoadLibrary will most probably generate a crash.
  2. Add a feature request.
  3. You can hook the instfiles dialog using a plug-in.
  4. If I understand you correctly, you're talking about a background window that was once used by NSIS. If it was used, you can find code to create it in CVS.
  5. This code:
    Caption "$(^SetupCaption)"
    
    rightfully generates the following error for me:
    Error: LangString ^SetupCaption is recursive!

For the instfiles dialog, I have tried using something similar to the banner plugin in my dll and that did not work. If you could post an example with source code, I can integrate it into my dll (therefore avoiding me having to write alot more code to manually move the progress bar and set the detailprint - I am still new to C/C++).

I have also made a completely new abort to finish system in my user interface - I am not revealing any more about it no matter how much you beg me :).

edit: I forgot to mention, would it be possible during the crc check to move a progress bar (which is put in manually)? I have one on my UI and I was just wondering if this could be added (if you have a huge installer (700MB) the crc check stays for about 10-20 seconds and I would like somthing to be happening during the check).


To change the instfiles page, you'd have to subclass, and probably hide, the original progress bar. Then you'd have to forward any PBM_SETPOS message it gets to your progress bar. The code that handles it is available on the top of the exec.c file.

To move a progress bar in the CRC dialog you'd have to change the source code of NSIS itself (fileform.c). No script is ran and so no plug-in is extracted, until the CRC check completes. But something is moving. It shows the progress using percentages.


Well, I am going to reinvent the wheel (so to speak), and make a completely new section system in my UI. Basically it is the normal section commands disguised by the UI with extra code added. This will automatically move the progress bar if the user wants to use the custom instfiles page I have made. I will also use a VB6 Active X progress bar like the ones use on the InstallShie1d installers. I have probably revealed to much about my UI in this thread :) (I was trying to keep quiet about it).

One more question: Would I be able to read the license file text into nsis, and then set it (using sendmessage) to the text control on an installoptions page? Or is there another way to display the license text in an installoptions page?


Originally posted by JasonFriday13
One more question: Would I be able to read the license file text into nsis, and then set it (using sendmessage) to the text control on an installoptions page? Or is there another way to display the license text in an installoptions page?
You can, but you'll need a plug-in, like System, to avoid the 1024 characters limit.

Mayby I didn't explain correctly what I wanted with plugin unloading. I want it the same as it is now, but if you set SetPluginsUnload to alwaysoff, the plugins never unload, correct? So if I wanted an /UNLOAD flag on a dll call, it would call loadlibrary, call the exported function from the dll, then the /UNLOAD flag unloads the dll from memory after the function returns.

For anyone who compiles 150MB+ installers and have the crc check on, I have added three lines of code to fileform.c and the result is the verify dialog moves a progress bar during the crc check. The ripoff is that it adds 500 to 1000 bytes of data to the stubs :( . Anyway, I have included fileform.c in the attachment along with the compiled stubs for people who don't want to recompile NSIS.


Also, I have made a simple program that convert RGB, eg. 255 0 255, to hexadecimal, eg. FF00FF. This little app has no license, so you can do what ever you like with it. This app was made in VB6 (you must have the vb runtimes to run this app).