Archive: BgGradient and CRC patch


BgGradient and CRC patch
I have just got back from my two week holiday from college, and I have been busy. I have added a patch to add a border, a title bar, and a system menu to bggradient, with defines in scons to turn it on and off. I also added to the crc check the ability to move a progress bar. You have to add the progress bar to the verify dialog using resource hacker, and give it and id of 3003 (I think). InstallSpiderUI already has the progress bar on it. Requires nsis 2.07 and above.

Here is the binary stubs...


...and here is the source code. Will now work on a stub that has no compression code in it for the installers that have 'SetCompress off' in the script (for a smaller stub and to say there is 'Using no compression' instead of 'Using zlib compression' after you compile a script).


Thanks for the patches. Please submit patches to the patch tracker for easier tracking.


I am not a member of sourceforge.net yet, so I can't submit patches.

1. 1KB extra on stubs (half a KB on some)

2. Yes I have tested the patch, and the latest InstallSpiderUI release uses this patch. I made the bggradient window a child of a dummy window so that the taskbar button for the bggradient window does not show. I also disabled the minimize and maximize buttons, as well as disabling the window, so that the user cannot interact with the bggradient window on runtime (it still minimizes and maximizes with the main installer window).

3. I just relised it could actually be used with any nsis version (not just the scons built nsis) because I included a file (config_old_scons_nsis.h) with the defines for older scons nsis versions, which could be used for pre scons nsis versions as well. My mistake.

Note: files for source code taken from nsis 2.15 source.


I am not a member of sourceforge.net yet, so I can't submit patches.
Signing up is free and requires no more than 5 minutes.
  1. Did you check the exact numbers in the map file?
  2. Tried all the winkey shortcuts? Winkey+M, Winkey+D? Other applications minimizing the window? I only ask because it took me a while to get it right for the current implementation.

1. Didn't know there was a map file :confused:.

2. As far as I can see, winkey+D and winkey+M do work correctly. The only thing I added for the patch is a dummy window, and changed the window style to make it have a title bar and system menu (although they can't actually be used). I have commented where the extra code is in the source.

Just registered at sourceforge.net.


Another update (hopefully for good). Fixed the bottom of the window not covering the taskbar. As before, binary stubs for NSIS 2.07 and above...


...and the source for (almost) any nsis version.

[edit]This one will be submitted to the patch tracker in the near future (don't know how near).[/edit]


Well, that day in the near future has come and gone. I have just submitted it to the patch tracker here.
[edit]fixed typo[/edit]


I stated that the progress bar id for the verify dialog was 3003, when it is actually 3300. I didn't check until now :rolleyes:.


I have revived work on this little project again. This time, I am adding the patch as switches to the BGGradient command.

[edit]Forgot to say that the crc progress bar will not be in this patch.[/edit]

I added it in the last hour or so to the source of NSIS 2.19. I will be compiling and testing over the next five days to make sure it works the way I intended. Example usage:

BGGradient /TITLEBAR /DROPSHADOW 0000FF 000000 FFFFFF

The /TITLEBAR option adds a border and title bar to the top of the window (along with the caption from the main window).

The /DROPSHADOW option adds a black dropshadow to the text in the background.

If I'm lucky, this might be added to an NSIS release, doubtful though :(.


I didn't want to create a new thread, and since it is related to showing windows, I will ask it here.

When the background window is displayed, it is shown behind the main installer window. I am trying to do the same on one of my new plugins, but the window is in front of the installer (in other words, the window is shown, and any message boxes that pop up are mostly hidden by the window I have created). Is there a simple fix for this (like SetWindowPos)?

I have attached an example.


You can use SetWindowPos to set your window to show below the installer window. Call SetWindowPos on the your window's handle and pass the installer's window handle in hWndInsertAfter.


Yeah, I figured that out on the weekend, but it does not work :(. I thought it would.

My next step is to use the code from the BgImage plugin to create the window (because the window for that is behind the main installer window).

Update on the BgGradient patch: I have put in the script parsing code for it, but found out it is not so easy to add a command to NSIS (2.15). I am having trouble writing and reading the correct value to and from the exehead. If someone could give me a crash course on adding info to the exehead and reading it from the exehead at runtime, that would be awesome.


Simplest way is changing the header structure (Source\exehead\fileform.h and Source\fileform.cpp). Then, you'll have your information in g_header in the exehead code.


Thanks for that. I will look at it.


It's probably because I have no idea whats wrong with my code. Source\fileform.cpp has the right fields in it to add to the bg part (bg_color1-2), but source\exehead\fileform.h dosen't have the same structure and I don't know how to set it. I have managed to get it so that it makes an error everytime the bggradient command is used, which means that the data is not being read/written (correctly).

I will be away for the next two and a half weeks so you probably won't get me until the 9th of October.


fileform.h is not automatically generated. You must add those fields on your own in the same place you've put them in fileform.cpp.