Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 18th May 2009, 18:06   #1
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 133
Send a message via AIM to jweinraub
Modal MessageBox

Guys,

Is there an option to make a MessageBox modal? MB_TOPMOST doesn't seem to do the trick. I have a question box that I want to be centre/top and unable to do anything until answered.

Is this possible with NSIS?

Thanks
jweinraub is offline   Reply With Quote
Old 18th May 2009, 18:16   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
I'm not sure what your problem is. The MessageBox instruction produces a modal message box which until a selection is made, halts code execution. Where are you showing one?

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 18th May 2009, 19:04   #3
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 133
Send a message via AIM to jweinraub
I want one similar to a modal box like mfc produces so it takes focus. Not just installation halt but doesn't allow anything else to be done too until question answered. Like if you click outside of the box, the computer will ding.
jweinraub is offline   Reply With Quote
Old 18th May 2009, 19:31   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,775
why do you want to hurt your users?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th May 2009, 20:01   #5
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 133
Send a message via AIM to jweinraub
I don't, it was more if it was possible :-)
jweinraub is offline   Reply With Quote
Old 18th May 2009, 21:23   #6
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 545
To make a Messagebox modal you have to pass the parent window handle instead of NULL.

You can do this by
code:
!include "${NSISDIR}\Examples\System\System.nsh"
!define STYLE ${MB_OK}|${MB_ICONINFORMATION}
System::Call 'User32::MessageBox(i $HWNDPARENT, t "The text", t "A caption", i ${STYLE}) i.'


(Shameless copy from a post from aerDNA in the MessageBox with more buttons thread)
jpderuiter is offline   Reply With Quote
Old 18th May 2009, 21:25   #7
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 545
Hmm, and this is exactly what the NSIS MessageBox is doing, so what is your question?
jpderuiter is offline   Reply With Quote
Old 18th May 2009, 21:49   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
jweinraub I very much doubt this is possible with Windows as is. Have you ever seen this done before in an installation wizard?

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 19th May 2009, 11:59   #9
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
I've seen it done before in some applications that throw an error (and I don't mean the UAC prompt).. so it can be done, but it sure is annoying(!)
Animaether is offline   Reply With Quote
Old 19th May 2009, 13:30   #10
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 133
Send a message via AIM to jweinraub
I don't recall if I ever seen an installation program do it, but I have seen Windows programs do it.
jweinraub is offline   Reply With Quote
Old 19th May 2009, 15:24   #11
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 133
Send a message via AIM to jweinraub
Techically that example is modal to the parent window, not the desktop. I believe a true modal dialogue won't let you do anything else until that has been answered...

But I don't plan on doing anything that will make our customers annoyed it was just a curiosity question.
jweinraub is offline   Reply With Quote
Old 19th May 2009, 15:47   #12
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 545
Quote:
Originally posted by jweinraub
Techically that example is modal to the parent window, not the desktop.
Yes, you're right.
I didn't understand what you are trying to do at first.

Quote:
Originally posted by jweinraub
I believe a true modal dialogue won't let you do anything else until that has been answered...
As far as I know, a modal dialog is only modal to it's parent window, not to windows from other programs.
http://en.wikipedia.org/wiki/Modal_window

To make something you want, you will have to do something like the Windows XP shutdown dialogbox:
Make a screendump, show it on top of everything, and place your dialogbox on top of that.
See http://www.codeproject.com/KB/dotnet/DimmerForm.aspx for an example (.NET)

But as said before, I don't think that is something you want to do to your users...
jpderuiter 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