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
Archive: Modal MessageBox
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
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
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.
why do you want to hurt your users?
I don't, it was more if it was possible :-)
To make a Messagebox modal you have to pass the parent window handle instead of NULL.
You can do this by
!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.'
Hmm, and this is exactly what the NSIS MessageBox is doing, so what is your question?
jweinraub I very much doubt this is possible with Windows as is. Have you ever seen this done before in an installation wizard?
Stu
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(!)
I don't recall if I ever seen an installation program do it, but I have seen Windows programs do it.
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.
Originally posted by jweinraubYes, you're right.
Techically that example is modal to the parent window, not the desktop.
Originally posted by jweinraubAs far as I know, a modal dialog is only modal to it's parent window, not to windows from other programs.
I believe a true modal dialogue won't let you do anything else until that has been answered...