Archive: Change the size of the icon for loading window?


Change the size of the icon for loading window?
How can I change the size of the icon shown in the setup loading window and the size of the place for the header bitmap?
Thanks in advance!


Open up the UI file (Contrib\UIs\modern.exe or default.exe) in Resource Hacker, edit dialog 111, save as another UI and use MUI_UI or ChangeUI to tell NSIS to use it.


Thanks for your reply. I used VisualStudio and edited dialog 111 in modern.exe, removed the old icon and put a new bitmap. Then saved it to a new name. Now the loading window doesn't have any image... Any idea?


ChangeUI (which is what MUI_UI uses) does not take anything else but the dialogs from the resource file. If you want to show the bitmap you'd have to add it yourself to the exe. You should be able to do that using !packhdr and using Resource Hacker's command line options. If you search the forum for !packhdr or Resource Hacker you should find a thread about someone who used the same method but to add XP manifest.


Please, excuse my stupidity, but I really cannot understand what is happening. After it didn't work with VisualStudio, I downloaded ResourceHacker but the effect was the same. I removed the icon from dialog 111 and put another bitmap. Then I save as another .exe file and used it with !define MUI_UI. The bitmap is there, because I put it over the text field and it is overlapped, but the bitmap content is not there - it is grey. And I really don't understand what is this !packhdr for! Should I use it after I put the bitmap inside the modern.exe and saved it as another name.exe or I may not use it? Please, help!


The bitmap you've added to modern.exe is not part of the dialog, only the bitmap holder. As ChangeUI (MUI_UI too because it uses ChangeUI) doesn't take anything else but the dialogs from the file you specify, the bitmap you've added to modern.exe is not inserted into the resulting installer. To add this bitmap manually, you can use !packhdr. !packhdr allows you to run a program that will modify the exe header. You can use this to add the bitmap back inside. You can call Resource Hacker with some command line arguments that will tell it to add the bitmap to the exe header.

For example (replace 1 with the desired resource id):

!packhdr exehead.tmp '"C:\Program Files\Resource Hacker\ResHacker.exe" -add exehead.tmp,exehead.tmp,mybitmap.bmp,BITMAP,1,'

or:

!packhdr exehead.tmp '"C:\Program Files\Resource Hacker\ResHacker.exe" -add exehead.tmp,exehead.tmp,myuifile.exe,BITMAP,,'


Hello again. Here is where I've come to:

I edited modern.exe with Resource Hacker and saved it as c:\MyUI.exe. The only thing I did is that I added one more bitmap to dialog 111.

Then in the script I added the following code:

!define MUI_UI "c:\MyUI.exe"

!packhdr "c:\exehead.tmp" '"C:\Program Files\Resource Hacker\ResHacker.exe" -add c:\MyUI.exe,c:\exehead.tmp,c:\MyBMP.bmp,BITMAP,101,'

I set all paths to c:\ to avoid any quote problems, because I hade some...
So the result is the following error:
Error finding icon resources: no icons?! -- failing!
Error - aborting creation process


You got the !packhdr line wrong. You replaced the first exehead.tmp with your UI file. You should have replaced just the third parameter with your UI file.


I'm going crazy with this thing!... Changed the line to:

!packhdr "c:\exehead.tmp" '"C:\Program Files\Resource Hacker\ResHacker.exe" -add c:\exehead.tmp,c:\exehead.tmp,c:\MyBMP.bmp,BITMAP,101,'

Now it compiles but when I run the setup, the bitmap is still not there! Please, help!


Are you sure the bitmap place holder you've inserted in dialog 111 is looking for a bitmap with id 101?


Yes, I think te bitmap holder ID is 101. You can see on the attached file.


That's the id of the bitmap holder. You need to set the caption of the bitmap holder to the id of the bitmap. If that doesn't work with a number, try a name.


It worked! Great! Now I have to fix two minor problems:

1. If I set the height of the window and height of the bitmap place holder to 48 pixels, and my bitmap is 48x48 pixels, the dialog looks higher than the bitmap when I run the setup.
I fixed this problem by visually adjusting the height of the dialog to be as high as my bitmap, but I wonder why I had to do it this way and why the dialog is not really 48 pixels high when it says that it is 48?

2. As you remember I set all paths to c:\ because I had quotes problems. When I put the whole second parameter of !packhdr in single quotes, and inside it I put every different file path in double quotes, it said that c:\Program is unknown path - this is happening because it doesn't recognize the quotes... So now when I want to move the files to their original locations what to do with the full paths which have to be quoted because contain spaces?


1. It's probably the border. Remove DS_MODALFRAME if you don't want a border.

2. Resource Hacker's manual says:

If paths are not included with filenames, then the operating systems’ current folder is presumed to contain the named file. It is generally good practise, though not required here, to enclose filenames contain spaces within double quotes.
So you can just skip the paths. But if you really want, you should probably quote each path on its own, not the entire parameter of the -add switch.

I mean the following:

!packhdr "c:\exehead.tmp" '"C:\Program Files\Resource Hacker\ResHacker.exe" -add c:\exehead.tmp,c:\exehead.tmp,"\..\extras\MyBMP.bmp",BITMAP,101,'

As you see here all the second parameter of !packhdr is inside the single quotes, and inside the paths are in double quotes. If only the path to reshacker.exe is inside the double quotes, it's ok, but if I put more quotes for some of the parameters of -add switch, it will say c:\Progra, path not found...


Thanks a lot for your help! I found a way to manage somehow with the quotes problem, so everything is ok now!