Skip to content
⌘ NSIS Forum Archive

How to hide the close button on a custom page window?

9 posts

JamesKiller#

How to hide the close button on a custom page window?

I have one custom page, want to hide the close[X] button, because we don't want users to cancel or close the page during copying files.
Any thoughts, thanks.
Red Wine#
In your custom ini under settings add CancelEnabled=0

EDIT: gosh I misunderstood, you mean the X button, if I remember correctly discussed recently here, perform a forum search.
JamesKiller#
Yeah, I have disabled cancel button, the close button doesn't work at all.
So since the close button looks like a dummy button, why need I to show to users?
That's why I want to hide it as well.
JamesKiller#
I am wodering that the code you gave me last time:

System::Call 'user32::GetWindowLong(i $hwndparent,i -16)i.r0'
intop $1 0x30000 ~
intop $0 $0 & $1
System::Call 'user32::SetWindowLong(i $hwndparent,i -16,i $0)i'

this function can hide the System Minimize and Maximize buttons, how can i just modify it to hide the close button, and only can apply it on my specific custom page.

Thank you guys.
kichik#
Use tonight's nightly build of InstallOptions where the X button is disabled when the CancelEnabled=0 is used, or use the code from the following thread.

Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
JamesKiller#
sorry, I wanna apply it to install page...
!define MUI_PAGE_CUSTOMFUNCTION_PRE 'CopyFiles'
!insertmacro MUI_PAGE_INSTFILES

!define SC_MINIMIZE 0xF020
!define SC_MAXIMIZE 0xF030
!define SC_CLOSE 0xF060

!define MF_GRAYED 1

Function CopyFiles

GetDlgItem $R0 $HWNDPARENT 1
ShowWindow $R0 ${SW_HIDE}
GetDlgItem $R0 $HWNDPARENT 2
ShowWindow $R0 ${SW_HIDE}
GetDlgItem $R0 $HWNDPARENT 3
ShowWindow $R0 ${SW_HIDE}

System::Call 'user32::GetSystemMenu(i $HWNDPARENT, i 0) i .r0'
System::Call 'user32::EnableMenuItem(i s, i ${SC_MINIMIZE}, i ${MF_GRAYED})'
System::Call 'user32::GetSystemMenu(i $HWNDPARENT, i 0) i .r0'
System::Call 'user32::EnableMenuItem(i s, i ${SC_MAXIMIZE}, i ${MF_GRAYED})'
System::Call 'user32::GetSystemMenu(i $HWNDPARENT, i 0) i .r0'
System::Call 'user32::EnableMenuItem(i s, i ${SC_CLOSE}, i ${MF_GRAYED})'
FunctionEnd


it seems that I can hide "next, cancel,back" button, but i couldn't hide the Close[X] button?
something wrong with my code?
JamesKiller#
yeah...
I have download the latest buid of NSIS, the close button looks disabled
that what I want, if it could be hidden, then would be perfect for me.