Archive: How Reactivate the menu close button (X) ?


How Reactivate the menu close button (X) ?
Hi,

By default NSIS disable the menu close button (X) at instfiles.

But he not "re-enable" the same button after the installation completed.

Is not a big problem with stadard Windows GUI,

beacause we see clearly the state of the button.

But, i use the SkinCrafter Skins and is not always

easy to distinguish the actual state of the button.

If the user click on the button the window dont close obviously.


I try a post function for fix that,

but NSIS "re-disable" the button.


Another idea ?

Tanks


##########################################################################
##########################################################################

!include nsDialogs.nsh

!include logiclib.nsh

##########################################################################

OutFile "XTest.exe"

##########################################################################

Caption "Caption"

SubCaption 3 " 33333"

SubCaption 4 " 44444"

CompletedText "CompletedText"

XPStyle on

ShowInstDetails show

##########################################################################

Var MyDialog

Var MyGroup

##########################################################################

Page custom MyCustomWelcome

Page instfiles _PreInstfiles _ShowInstfiles _PostInstfiles

##########################################################################

Function MyCustomWelcome

nsDialogs::Create 1018
Pop $MyDialog

${If} $MyDialog == error
Abort
${EndIf}

${NSD_CreateGroupBox} 0 0 398 208 "My Custom Welcome Page"
Pop $MyGroup

SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:My Welcome Caption"

nsDialogs::Show

FunctionEnd

##########################################################################

Function _PreInstfiles

Nop

FunctionEnd

##########################################################################

Function _ShowInstfiles

Nop

FunctionEnd

##########################################################################

Function _PostInstfiles

###########################

push $0
System::Call "user32::GetSystemMenu(i $HWNDPARENT,i 0) i.s"
pop $0
System::Call "user32::EnableMenuItem(i $0,i 0xF060,i 0)"
pop $0

###########################

MessageBox MB_ICONQUESTION 'My Function _PostInstfiles Enable the menu close button (X) $\r$\rBut NSIS Disable it a another time : ('

###########################

FunctionEnd

##########################################################################

Section

DetailPrint "A"
DetailPrint "B"
DetailPrint "XXXXXXXXXXXXXXXXXXXXXXXXX C"

sleep 1000

DetailPrint "XXXXXXXXXXXXXXXXXXXXXXXXX D"
DetailPrint "E"
DetailPrint "F"

sleep 1000

DetailPrint "XXXXXXXXXXXXXXXXXXXXXXXXX G"
DetailPrint "H"
DetailPrint "I"

sleep 1000

DetailPrint "XXXXXXXXXXXXXXXXXXXXXXXXX J"
DetailPrint "K"
DetailPrint "L"

sleep 1000

DetailPrint "XXXXXXXXXXXXXXXXXXXXXXXXX M"
DetailPrint "N"
DetailPrint "O"

SectionEnd

####################################################################################################


hm.. even if you do re-enable it outside of instfiles (say, on a following page), it doesn't do anything; it will just give a default beep sound.

http://forums.winamp.com/showthread....ose+AND+button

Enabling the 'cancel' button before/after doesn't have any effect either - the [X] button is pretty much dead.

Must be a simpler solution for this, but if push comes to shove, you may be able to write your own custom page to replace InstFiles; you won't get all the automatic DetailPrints, though. On the other hand, you get to write -only- those details that you want to print, so there's up sides to that approach as well.


hmm.. okay, the scenario where you have another page after does work, as long as you use the /ENABLECANCEL flag


Page custom MyCustomWelcome
Page instfiles _PreInstfiles _ShowInstfiles _PostInstfiles
Page custom MyCustomWelcome /ENABLECANCEL

No luck on having it enabled at the end of InstFiles itself, though. Do you need to keep that in view, or could you use autoclose?

May be with a litle timer ?


doesn't look like it - an nsDialogs timer won't be created, it seems.. and I'm not too sure how you would invoke a system timer to call an NSIS function - I suppose using the System plugin and callbacks somehow. There -is- also a plugin that delays an action.. I think it's called 'delay', but I can't seem to find it with google right now.. was an unfinished plugin, iirc.


Tank you for you interest

SendMessage...../TIMEOUT=XXXX

/TIMEOUT=XXXX is a mysterious argument we can use with SendMessage

I don't know what is it.

I don't know how use it.

But i know that exist...

It just a brainstorming possible solution...not more.


timeout just means that NSIS will wait that long for the SendMessage command to return a result; if it doesn't get a result within that time, it will consider the command to have failed and will continue with the script. 'fraid that's not what you'd be looking for