Skip to content
⌘ NSIS Forum Archive

progressbar manipulation

33 posts

TheChewy#

progressbar manipulation

Is it possible to manipulate the progressbar to increase / decrease the space for a certain section of the de-, installer progress?
deguix#edited
👍

It is possible. But you need to do this inside a function (but this function can be called from a section), because when you put this code in a section, it doesn't work (NSIS sets the progress indicator bar position value everytime when passing by a command):

!define PBM_SETPOS 0x0402
# !define PBM_DELTAPOS 0x0403
# Use PBM_DELTAPOS if you want to increment,
# not to set, the value.
Section
# Other things
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R0 1004
Call ChangeProgressIndicatorBarPosition
# Other things
SectionEnd
Function ChangeProgressIndicatorBarPosition
StrCpy $0 50 # Set indicator bar in position "50%"
IntOp $0 $0 * 300
SendMessage $R0 ${PBM_SETPOS} $0 ""
# If you want to see the show above, put a
# MessageBox command after the command above,
# so it doesn't disappear, until you click OK.
# OR if you want to increment, not to set, the new
# position, you can use ${PBM_DELTAPOS}.
# SendMessage $R0 ${PBM_DELTAPOS} $0 ""
FunctionEnd 
Dj Nyx#
is there any way to display the progress bar like the "xp-progress bar"?
i read some threads but i wasn't able to find out exactly if it's possible...
eccles#
If you are not using MUI then make sure you have XPStyle on at the start of your script (MUI includes this automatically), but, of course, only when installing on XP will this have an effect.
Dj Nyx#
and is there any way to make something like this [attached file]
Dj Nyx#edited
is there a manual "how to create a UI file with a custom dialog and window messages for dummys"? 😁
Joost Verburg#
No. Get a resource editor to modify the UI file and search MSDN for information about window messages to use.
Dj Nyx#
ok.
one more question...
do you know a simple resource editor?
and which file is the ui file
[i'm a total greenhorn]
Dj Nyx#
ok I was able to make 5 checkboxes in the modern.exe [for me this is no mean feat 😁 ]
now the next step is to set the caption of the checkbox.
[name of section 1 is caption of checkbox 1, ...]
I rumaged many sites, but I'm still planless... [I know I'm a little nerving] 🙁
Dj Nyx#
first i tried it with a sample from the archive:
    GetDlgItem $R0 $HWNDPARENT 3
    SendMessage $R0 ${WM_SETTEXT} 0 "STR: pOiSoN"
    MessageBox MB_OK "HWNDPARENT: $HWNDPARENT"
    MessageBox MB_OK "R0: $R0" 
and this worked.

then i opened the ressource hacker and I assigned the checkbox the id 3333.
    GetDlgItem $R0 $HWNDPARENT "#3333"
    SendMessage $R0 ${WM_SETTEXT} 0 "STR: pOiSoN"
    MessageBox MB_OK "HWNDPARENT: $HWNDPARENT"
    MessageBox MB_OK "R0: $R0" 
but it doesn't work.

do you know whats my failure?
Joost Verburg#
If it's on the inner dialog you'll have to use the handle of that dialog. See users manual section 4.9.14.6.
Dj Nyx#
ok thank you very very much joost
respect to you patience ;-)

this is the working code [only 3 lines, i can't take it ~gg~]

Var window
Section "Hauptgruppe" SEC01FindWindow $window "#32770" "" 
FindWindow $window "#32770" "" $HWNDPARENT 
GetDlgItem $R0 $window "3333"
SendMessage $R0 ${WM_SETTEXT} 0 "STR: textofthecheckbox" 
Dj Nyx#
hi again 🙄
i opened the
List of common Windows Messages
By KiCHiK
file

with which option am I able to change the status of the checkbox [checked/unchecked]?
Joost Verburg#
It's not in that list. See MSDN or http://forums.winamp.com/showthread....hreadid=175303
Dj Nyx#
so, now everything works...

i have 5 checkboxes and i am able to "check" or "uncheck" them... great 😛
i don't know if its necessary to post my code. shall i?¿
Dj Nyx#edited
ok it's not really elaborate...

first i made 5 checkboxes [with a resource editor: "Resource Hacker"][into the modern.exe]
then i gave them the ids "3333", "3334", "3335", "3336" & "3337".

so, now i had to set the captions...
first you have to set a variable [in my code it is $InstallWindow]

Var InstallWindow
Section "createWindow" SEC01
;1st
    FindWindow $InstallWindow "#32770" "" $HWNDPARENT 
    GetDlgItem $R0 $InstallWindow "3333"
    SendMessage $R0 ${WM_SETTEXT} 0 "STR: Caption1"
;2nd
    GetDlgItem $R0 $InstallWindow "3334"
    SendMessage $R0 ${WM_SETTEXT} 0 "STR: Text2"
;3rd
    GetDlgItem $R0 $InstallWindow "3335"
    SendMessage $R0 ${WM_SETTEXT} 0 "STR: Text3"
;4th
    GetDlgItem $R0 $InstallWindow "3336"
    SendMessage $R0 ${WM_SETTEXT} 0 "STR: Text4"
;5th
    GetDlgItem $R0 $InstallWindow "3337"
    SendMessage $R0 ${WM_SETTEXT} 0 "STR: Text5"
SectionEnd 
So now i can check/uncheck any box with

GetDlgItem $R0 $InstallWindow "3333"
SendMessage $R0 ${BM_SETCHECK} ${BST_CHECKED} ""
GetDlgItem $R0 $InstallWindow "3335"
SendMessage $R0 ${BM_SETCHECK} ${BST_UNCHECKED} "" 
Dj Nyx#
so now I have a little problem [its not really important...]

i had the captions of the ckeckboxes in a languages.nsh
[
LangString CUSTOM_INSTFILES_CHECKBOX_FIRST${LANG_GERMAN} "Ein Männlein steht im Walde ganz still und stumm, Es hat von lauter Purpur ein Mäntlein um. Sagt, wer mag das Männlein sein, Das da steht im Wald allein. Mit dem purpurroten Mäntelein. " 
]

i read somewhere here that i have to include this language file at the bottom...
no problem...until i tried to uninstall this...

i think that the language.nsh isn't include...
what can i do?
Dj Nyx#
and it goes on...

is there a way to make the caption of a checkbox bold?
i looked in the winmessages.nsh, but havent found what i need...