Old 22nd March 2016, 14:40   #1
Bungkai
Junior Member
 
Join Date: Nov 2015
Posts: 23
Customizing MUI_PAGE_INSTFILES

Sorry if this has been asked before, but my GoogleFu got me nowhere.

I want to customize the MUI_PAGE_INSTFILES page. I have a plugin all worked out that just runs the page when clicked. I currently have tried to use the NSISDialogDesigner to create such a page but when I reference it with 'Page custom fnc_test_Show' , all it does is how the page with all the buttons and stuff that do not do anything and the progressbar does not move. So obviously I'm missing something. My NSIS knowledge isn't the greatest, so if possible, dumb it down for me a tad. Any help is appreciated.

edit: This is how it looks currently.. Click image for larger version

Name:	water.png
Views:	281
Size:	17.1 KB
ID:	52318

Is there a way to get rid of the top banner, bottom banner, have the image encompass the entire install window and also the progress bar to actually move? I can probably figure out how to remove the banners, but getting the progress bar to work with my installation is my main problem at the moment.
Bungkai is offline   Reply With Quote
Old 22nd March 2016, 17:46   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,504
To customize the instfiles page you can download Resource hacker and the edit one of the UIs in the Contrib\Ui folder and then apply it with the ChangeUI instruction.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 22nd March 2016, 18:48   #3
Bungkai
Junior Member
 
Join Date: Nov 2015
Posts: 23
Which one am I supposed to change? When I'm running my installer, it looks exactly like default.exe but when I'm making changes to see if it's the right one(Taking off icon, progress bar), the change isn't going through when I recompile. (Also tried changing a couple other ones too and the change still isn't going through.)

edit: it shows on Resource Hacker, but doesn't on NSIS.
Bungkai is offline   Reply With Quote
Old 22nd March 2016, 18:52   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,504
One of the modern*. exe ones should be your startingpoint, depends on your MUI settings. Then save it as yourfile.exe and then add !define MUI_UI ${NSISDIR}\Contrib\UIs\yourfile.exe

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 22nd March 2016, 19:42   #5
Bungkai
Junior Member
 
Join Date: Nov 2015
Posts: 23
Ok, now I'm getting a hit.. I'm trying to modify modern.exe, i saved it as modern_edited and used '!define MUI_UI ${NSISDIR}\Contrib\UIs\yourfile.exe' as you've stated, but I am getting an error. In Resource Hacker, I removed all controls except for the push buttons and now it's giving me grief for it. Any reason why?

It's trying to find the things that I deleted :/ but I want to get rid of them.
Bungkai is offline   Reply With Quote
Old 22nd March 2016, 20:24   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,504
If you saved it as modern_edited then the define also has to point to modern_edited.

You cannot delete all controls but you can make them not visible and/or move them so they are not visible...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 23rd March 2016, 14:50   #7
Bungkai
Junior Member
 
Join Date: Nov 2015
Posts: 23
This may make my life easier. Thanks for being patient with me.
Bungkai is offline   Reply With Quote
Old 23rd March 2016, 20:01   #8
Bungkai
Junior Member
 
Join Date: Nov 2015
Posts: 23
Hi Anders, Sorry to bother you again but I have seen this page from you: http://nsis.sourceforge.net/Image_in...dow_background

and am wanting to incorporate it with what I am trying to do. I want to ONLY use just the MUI_PAGE_INSTFILES. I've been able to get rid of most of the other pages without a problem and cleave all the corresponding page functions but as soon as I try to get rid of MUI_PAGE_FINISH, I get the following error that points to 'Function InstFilesPageShow'.

code:
Usage: FindWindow $(user_var: handle output) WindowClass [WindowTitle] [Window_Parent] [Child_After]


And it seems to only trigger on the finish page and I'm wondering why.
Bungkai is offline   Reply With Quote
Old 23rd March 2016, 20:56   #9
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,504
Quote:
Originally Posted by Bungkai View Post
Sorry to bother you again but I have seen this page from you: http://nsis.sourceforge.net/Image_in...dow_background
How is this my code? Maybe you need glasses?

The code on the page you linked to was never tested without a Welcome nor Finish page and when you remove those the MUI_HWND variable is never declared.

Add
PHP Code:
!ifndef MUI_VAR_HWND
  
Var MUI_HWND
  
!define MUI_VAR_HWND
!endif 
before the InstFilesPageShow function or change $MUI_HWND to something like $1

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 24th March 2016, 12:16   #10
Bungkai
Junior Member
 
Join Date: Nov 2015
Posts: 23
I... may have drank some alcohol without even knowing it. No idea how I associated the two of you as one entity.

Thanks for the help, much appreciated.
Bungkai is offline   Reply With Quote
Old 24th March 2016, 14:33   #11
Bungkai
Junior Member
 
Join Date: Nov 2015
Posts: 23
One more thing.. I'm now trying to change the color of the progress bar and I've used the following references:

https://nsis-dev.github.io/NSIS-Foru.../t-268395.html
http://forums.winamp.com/showthread.php?t=268395


And I've placed the
code:
!define MUI_INSTALLCOLORS "FF0000 00FF00"
!define MUI_INSTFILESPAGE_PROGRESSBAR "colored"

above the page insertions, made sure my installer wasn't XPStyle, and tried turning it off as well. No errors, but no change in color.


I've also tried this from gfm688

code:
!define MUI_PAGE_CUSTOMFUNCTION_SHOW InstShow
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

!define PBM_SETBARCOLOR 0x0409
!define PBM_SETBKCOLOR 0x2001

Function InstShow
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1004
System::Call UxTheme::SetWindowTheme(i,w,w)i(r0,"","")
SendMessage $0 ${PBM_SETBARCOLOR} 0 0x000000
SendMessage $0 ${PBM_SETBKCOLOR} 0 0x3F48CC
FunctionEnd





but the error I get is that the variables were already defined. I was hoping this was an easier problem.
Bungkai is offline   Reply With Quote
Old 24th March 2016, 14:39   #12
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,504
Which variable? The PBM defines? If that is the case you can comment them out or use !ifndef around it. Posting the error message would help or at least tell us the name of the variable or define.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 24th March 2016, 15:00   #13
Bungkai
Junior Member
 
Join Date: Nov 2015
Posts: 23
Quote:
Originally Posted by Anders View Post
Which variable? The PBM defines? If that is the case you can comment them out or use !ifndef around it. Posting the error message would help or at least tell us the name of the variable or define.
Yes, sorry I meant the PBM defines.
It is giving me an error on the SendMessage for PBM_SETBKCOLOR.
code:
System::Call UxTheme::SetWindowTheme(i,w,w)i(r0,"","")
SendMessage $0 ${PBM_SETBARCOLOR} 0 0x000000
SendMessage $0 ${PBM_SETBKCOLOR} 0 0x000000



This is the error:
code:
SendMessage: ($0,0x409,0,0x000000)
Usage: SendMessage hwnd message [wparam|STR:wParam] [lparam|STR:lParam] [$(user_var: return value)] [/TIMEOUT=X]



I have also added the ifndefs as you stated as such before the page inserts

code:
!ifndef PBM_SETBARCOLOR
Var PBM_SETBARCOLOR
!define PBM_SETBARCOLOR
!endif

!ifndef PBM_SETBKCOLOR
Var PBM_SETBKCOLOR
!define PBM_SETBKCOLOR
!endif

Bungkai is offline   Reply With Quote
Old 24th March 2016, 15:08   #14
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,504
I think you are confusing variables and defines, defines are transformed into text/numbers early in the compiling stage but are also sometimes used to ensure that some other operation is only done once. Variables are storage slots used in the installer/uninstaller.

This time you just want:
Quote:
!ifndef PBM_SETBKCOLOR
!define PBM_SETBKCOLOR 0x2001
!endif

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 24th March 2016, 15:15   #15
Bungkai
Junior Member
 
Join Date: Nov 2015
Posts: 23
Ahh I definitely did confuse the two. I made the appropriate change though and I still got the same error.
SendMessage: ($0,0x409,0,0x000000)

I had believed the 2nd variable was supposed to change when I redefined it to 0x2001
Bungkai is offline   Reply With Quote
Old 24th March 2016, 15:27   #16
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,504
I think the problem is with the 2nd SendMessage, put a dummy !warning between them to make sure. It looks OK from here so I'm not sure what the issue is, not on a Windows machine right now so I can't really check.


The compiler is not very good at telling you what the problem is. SendMessage $0 $1 $2 $3 should compile, replace with real parameters until it fails to compile...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 24th March 2016, 16:32   #17
Bungkai
Junior Member
 
Join Date: Nov 2015
Posts: 23
Quote:
Originally Posted by Anders View Post
I think the problem is with the 2nd SendMessage, put a dummy !warning between them to make sure. It looks OK from here so I'm not sure what the issue is, not on a Windows machine right now so I can't really check.


The compiler is not very good at telling you what the problem is. SendMessage $0 $1 $2 $3 should compile, replace with real parameters until it fails to compile...
So it looks like it's definitely '${PBM_SETBKCOLOR}' that is the problem.. and you are correct that it is the 2nd SendMessage. First one works fine.. here's the function in case it's helpful.

code:
; For instfiles page.
Function InstFilesPageShow

; Set transparent backgrounds.
FindWindow $MUI_HWND "#32770" "" $HWNDPARENT
SetCtlColors $MUI_HWND 0xFFFFFF transparent

!insertmacro SetTransparent $MUI_HWND 1027
!insertmacro SetTransparent $MUI_HWND 1004

GetDlgItem $0 $0 1004
System::Call UxTheme::SetWindowTheme(i,w,w)i(r0,"","")
SendMessage $0 ${PBM_SETBARCOLOR} 0 0x000000
SendMessage $0 ${PBM_SETBKCOLOR} 0 0x000000

!insertmacro SetTransparent $MUI_HWND 1006
!insertmacro SetTransparent $MUI_HWND 1016

; Refresh controls.
Call RefreshParentControls

FunctionEnd

Bungkai is offline   Reply With Quote
Old 24th March 2016, 16:51   #18
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,504
Just use 0x2001 directly as the 2nd parameter then.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 24th March 2016, 16:59   #19
Bungkai
Junior Member
 
Join Date: Nov 2015
Posts: 23
Quote:
Originally Posted by Anders View Post
Just use 0x2001 directly as the 2nd parameter then.
Did that, error gone, but the color of the progress bar remains green. I've tampered with the numbers too to no avail.

edit: stripped the code down to the bare bones and just to what gfm688 originally recommended with your edits, and it actually works.. guess I've got some digging to do. Thanks a bunch Anders.

Last edited by Bungkai; 24th March 2016 at 18:12.
Bungkai is offline   Reply With Quote
Old 24th March 2016, 18:57   #20
Bungkai
Junior Member
 
Join Date: Nov 2015
Posts: 23
Just an update in case anyone stumbles into the same problem.. taking the other road that Anders told me to take (replace all iterations of MUI_HWND to $1) actually worked perfectly and the color no longer stays green and I'm finally able to play around with the color.
Bungkai is offline   Reply With Quote
Old 24th March 2016, 21:02   #21
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,504
I'm guessing the window handle in $0 was invalid, probably because of GetDlgItem $0 $0 1004, it should have a FindWindow command before it like it does at the start of the function but for $0

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump