Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 4th July 2008, 14:39   #1
wheleph
Junior Member
 
Join Date: Jul 2007
Location: Kiev, Ukraine
Posts: 12
Disable progress bar

Hello, guys.

I wan't to disable progress bar in MUI_PAGE_INSTFILES windows. Any suggestions?
wheleph is offline   Reply With Quote
Old 11th July 2008, 12:20   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Hide it using ShowWindow.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 11th July 2008, 15:35   #3
wheleph
Junior Member
 
Join Date: Jul 2007
Location: Kiev, Ukraine
Posts: 12
> Hide it using ShowWindow
kichik,
I don't understand what do you mean. I don't need to hide the whole window I just don't want a progress bar to be displayed. Give some script snippet to clarify your idea.
wheleph is offline   Reply With Quote
Old 11th July 2008, 19:25   #4
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
"ShowWindow" is an unfortunately-named function in the Windows APIs that allow you to show/hide an UI element.. be that a window or a textbox, checkbox, progress bar, etc.

NSIS keeps the same function name for code reasons.

What kichik means is that you should hide the progressbar by using "ShowWindow <progress bar control hwnd> ${SW_HIDE}"

That "${SW_HIDE}" is a code that is defined in one of the include files that comes with NSIS. Add "!include WinMessages.nsh" to the top of your script so that your installer will know what "SW_HIDE" means.

You can get "<progress bar control hwnd>" from the inner dialog of the installer. The inner dialog you can find with:
FindWindow $0 "#32770" "" $HWNDPARENT
Basically this says "Inside $HWNDPARENT (the installer's hwnd), look for the control identified as class #32770 (a dialog) and put the result in $0".

Then you need the ID of the control within that dialog. My suggestion is to download WinSpy++. Run that and drag the crosshairs over the progress bar when running an installer. It'll tell you the Control ID. In my case it's "3EC". This is a hexadecimal number, so if you refer to it, put "0x" in front.

So to get the control's hwnd out of the dialog, you would use:
"GetDlgItem $1 <dialog_hwnd> 0x3ec"
Meaning "From <dialog_hwnd>, get the control with ID 0x3ec, and put that in $1".

So now you have all the information you need to hide it.
code:

Section ""
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $1 $0 0x3ec
ShowWindow $1 ${SW_HIDE}
SectionEnd



That "3ec" isn't likely to change - however, if you want to make your code a little more robust, you can also refer to the progress bar's class. Remember how we got the class "#32770" to get the inner dialog? We can use the same to get the progressbar out of the inner dialog. The progressbar's class is "msctls_progress32". So the new code would become:

code:

FindWindow $0 "#32770" "" $HWNDPARENT
FindWindow $1 "msctls_progress32" "" $0
ShowWindow $1 ${SW_HIDE}



The code above should work fine in your installer (although you may wish to move the code outside of the Section code and inside a function that handles the dialog before any Sections), but I hope the above taught you something about FindWindow, ShowWindow, GetDlgItem and how to get a Control ID using WinSpy++ as well.
Animaether is offline   Reply With Quote
Old 15th July 2008, 08:48   #5
wheleph
Junior Member
 
Join Date: Jul 2007
Location: Kiev, Ukraine
Posts: 12
Thanks, Animaether, for your great post. It gives a comprehensive answer to my question. I've used the second approach (with 'FindWindow $1 "msctls_progress32" "" $0') in my installer.

Last edited by wheleph; 15th July 2008 at 09:11.
wheleph is offline   Reply With Quote
Reply
Go Back   Winamp 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