Skip to content
⌘ NSIS Forum Archive

MessageBox with more buttons

114 posts

n0On3#
Originally posted by DrO
[B]had a check of the code and the icon part works fine in a silent installer.
You mean that you could use the icon when silent installer in the messagebox? I used your example and now, not only it's not showed but even crashes 🙁

I attach the thingy.



also, what's this "MB_ICONHAND" style? the nsis I use doesn't have it... 🤪
DrO#
what OS are you using?
(checked the example and it is fine on NT4 and 2k)

also is it the last messagebox that is failing?

messagebox::show MB_TOPMOST|MB_DEFBUTTON2|MB_RIGHT "look at me a title" \
"" \
"and for a messagebox that will show an icon... 😳)$\n" "ah go on if you dare" IDYES IDYES2
with the second line, to get the installer icon it should be "0,103" instead of "" - typo on my part (was trying to get that test version done beofre i left for work)

-daz
DrO#
@n0On3 - if you can, can you let me know what the crash error is please (picture?)

I'll have a look at the code tonight (haven't touched it for a few days) and i'll make sure that any potential parts that could cause a crash are catered for. Will try and get a newer version up for tomorrow which should hopefully fix things for you.

Adding in parameter checks so that you can't do IDYES "blah" IDYES since it's not good having two 'Yes' buttons 🙂

also, what's this "MB_ICONHAND" style? the nsis I use doesn't have it...
magic that is 😉 it is just the stop sign icon but using a different name (throw back to Windows 3.x before 95 came along and they altered the defined names that's all, check here)

-daz
DrO#
added a page into the archive for the Customisable MessageBox plugin (thought a proper name would be good for it instead of 'MessageBox with more buttons' 😉)

-daz

[p.s. is it fine to just link to here for the downloads since i haven't anywhere to host files 🙁 ]
n0On3#
Originally posted by DrO
[B]what OS are you using?
(checked the example and it is fine on NT4 and 2k)

also is it the last messagebox that is failing?
sorry, I left that info. I use win98se. Does the compiled exe work in your 2k?

and is the first messagebox that fails. Strange because it works in another silent installer I made. But in that other it always shows 4 buttons. This is the code:
MessageBox::Show MB_ICONQUESTION "Can't Move, Copy instead?" "" \
`We can't move through different drives.$\nBut we can copy and \
delete if no errors` "Copy && Delete" "Copy" "IDCANCEL"
kichik#
Originally posted by DrO
[p.s. is it fine to just link to here for the downloads since i haven't anywhere to host files 🙁 ]
It can be put on the Archive too. Just e-mail the file to an Archive admin and we'll upload it.
DrO#
give this version a try - have altered the handling of one or two strings internally so hopefully it won't crash (had not fully checked the module handle for a "" situation).

also included two compiled versions (normal and silent) which work on my machine at least 😉

note: long button text handling is still fudged (got to get full limit checking working still)

note 2: just looking at the function call, the "IDCANCEL" should be just IDCANCEL (no "'s around it) if you want the button text to be 'cancel' 😉

@n0On3: will test that later. i tested your file on NT4 and it worked (will check later on my machine under both oses)

@kichik: will pm it once it's working fully 🙂

-daz
n0On3#
ok, I won't use "IDCANCEL" 😉


please, can some moderator edit my post and make it not soooooooo wide?


and... doesn't anybody know when this forum decides to create a second page???
DrO#
Originally posted by n0On3
ok, I won't use "IDCANCEL" 😉
ignore what i said about that, was half asleep at work and not remembering that the "" are stripped before being passed to the plugin 😕
(also it looks neater without the ""s for the predefined texts i think)

tested your file under 98 and 2k - crashed under 98 😢

found the problem (was only related to silent installers!) so new none crashing version is attached 😉

-daz

ps issue is that with the silent installer it does not have a window title and so my code for that was incorrectly handling a "" for the caption (so it was the second messagebox crashing 😉) - i just can't code at times 😁
Afrow UK#
I currently know nothing about win32 programming; you obviously must know quite a bit!

Good work!!

-Stu 🙂
DrO#
Originally posted by Afrow UK
you obviously must know quite a bit!
enough to get by with 😉

is mainly from playing around with things (all self taught though i wonder why at times 🤪 ) that i've learnt win32 and even then i still have to research things / spend hours working out why it won't work but that's the same with anything really

-daz

[edit]
p.s. starts a second page here 😉 @ n0On3
[/edit]
Afrow UK#
That's the way I get taught.
I know a few basic languages inside out by making the same program for my game in the different languages.
My programs basically read through a Quake2 log file getting the number of kills the entered name has done, how many deaths etc for specific weapons.

So far I've done it in Basic, QuickBasic, Perl and C
I'm looking forward to getting MS Visual Studio but that will come once I have finised school.

-Stu
DrO#
i remember basic 😉 first language i learnt back on my old atari ste (one for the history books and i've still got it).

only do c now since it's straight forward, have dabbled a bit in c++ but not enough to be able to do it all the time.

learnt the basics of c at uni and then win32 for my final project (a little editor and development thing for some DOS tools from the first year).

still developing the thing so that i can have a MDI text editor with customisable syntax highlighting of my source files. also worked on a thing to allow most windows and dialogs to 'dock' to the screen edge or the inside of MDI window eg Excel and that as linux does - makes positioning of windows easier to do but still have a few bugs with the code when it's closed down 🙁 (but with recent stuff i've done here i think i may have the solution to the problems)

File reading is the fun stuff to do 😉 windows hooks and subclassing are a real pain in comparison at times

-daz
n0On3#
hi, I used v0.98 beta 3 and still have the extra fourth button. I don't know how it got there 😔

MessageBox::Show MB_TOPMOST|MB_ICONQUESTION "Can't Move, Copy instead?" "" \\
`We can't move through different drives.$\nBut we can copy and delete if no errors` \\
"Copy && Delete" "Copy" IDCANCEL 
DrO#
can you post a screen shot of what's appearing for you. also what OS are you using?

i will have a look at the code again in a bit but i can't think what could be going wrong 🤪

also did this version definitely fix the crash issue you were having in the earlier versions?

-daz
n0On3#
yes, it seems that the silent crash is gone 🙂

I attach a snap. Using Win98se
DrO#
thanks for the picture and it's what i expected to see.

i managed to reproduce the problem and it's down to there being other values on the stack. the function will read in until it gets to the 4 button limit or there is nothing else on the stack hence what you get.

best option i can think of would be to add a control character on for the last button to ensure that the correct number of buttons are added
e.g. IDYES "blah" \eIDCANCEL

-daz
DrO#
yep, that's how they are passed for the plugin to get them. the issue with this plugin is that it takes variable parameters unlike most other plugins which accept a fixed number of parameters - hence the problem with reading what is available.

so the options are:
* a control flag on the last button
* assuming that if the stack parameter converts to a number to stop
* to control the number it expects (as in older versions)
* ensure the stack is clear before using the function

personally i think the first option is the easiest to use. didn't have enough time to make the above alteration last night, will be up by tomorrow.

-daz
kichik#
You can do what the author of UnTGZ has done. He forced an extra stack push of "--" for inputs of variant sizes. It's the most elegant and simple way in my opinion. Forcing a flag on the last button might cause the user to delete it when editing or move it around when moving the buttons.

BTW, nsisdt uses the $0 variable 😛
DrO#
yeah the flag option has it's issues 😉
i'll have a look at what you've mentioned, thanks.

-daz
scully13#
Can somebody help me out on this one. Here is the code I'm using:
messagebox::show "MB_ICONQUESTION" "" "" "$(TEXT_INSTCLIENT_MSG)" "$(TEXT_YES_MSG)" "$(TEXT_NO_MSG)"
I keep getting a third button like what is described above. I've tried the possible fixes except I can't figure out how to clear the stack to make the third button go away. I tried the control flag "\e$(TEXT_NO_MSG)" but then it just shows up in the buttons text. It also looks like the last option is one he was talking about putting back in but never did. Is there a newer version of this available or can somebody show me a workaround?
superwan#
and I'm upping this topic because I think you should explain in your txt what is the id of an icon group


I have this code :

messagebox::show MB_ICONEXCLAMATION|MB_ICONHAND|MB_TOPMOST "$(question_hercules)" \
"another_software.exe,103" \
"$(messagebox_hercules)" $(yes) $(no)
and I didn't find the good value for "103"

resource hacker gave me the good values...

say it in your help file 😉


see ya and thx for your great plugin dro 😉
superwan#
hello

I have this messagebox :


	messagebox::show MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST "$(question_hercules)" \
"0,103" \
"$(messagebox_hercules)$\n" "$(yes)"

Pop $0
StrCmp $0 "1" yes
StrCmp $0 "2" no

But I have no sound when it appears
I'd like that a window "question" sound comes...

How can I do ?


thx for your answers 😁
DrO#
point 1: yeah, i agree on that. i also really need to just better document the plugin (as well as finding the source code for it on my old machine otherwise it's re-write time which in some ways could be a good thing i think 🙂 and since there's a decent changelog in the zip i can re-work things if needed that way)

point 2: not sure to be honest, only thing i can think of is that you don't have a sound assigned to that system action (you'd need to check in the sound properties dialog)

-daz
DrO#
i've just looked through some info on msdn and the MessageBeep(..) needs to be called. as a work around you can use the system plugin to manually do this.

i think i will just do a complete re-code of the plugin and i'm noting down to have sound support in there as well (for some of my Winamp plugins i need to alter a standard messagebox so i intend to make a general core which will work for them and as a nsis plugin for this)

just as i was about to post i did a quick system scan and i've found what looks like the source code for 0.98beta (first one i believe) so i'll do a bit more and see what else i can find since if i can get 0.98b3 that'll make my life easier)

-daz
superwan#
yeah 😁

this is cool

I'm waiting for it 😉

"bon courage" like we say in France 😉 see ya 😁
Comperio#
Hey DrO,
This might be a moot point if you are still planning to re-write, but I thought I'd mention it:

In your latest reslease (v0.98 beta 3), I still get a crash with the silent install.

To recreate, just run the file messagebox_s.exe included with the package. The crash occurs on the message box that reads "And for the special options"

I've attached a screenshot of the message box that generates the error. i also noticed that the "no" button should be named "m12if you can!"

Here's the text of the error:
The application, , generated an application error The error occurred on 07/11/2005 @ 07:54:13.718 The exception generated was c00000fd at address 100023B4 (<nosymbols>)

This is nothing urgent--just letting you know.
Thanks! 😁
Yathosho#
btw, nsis (english translation) officially uses "OK" and not "Ok", like that messagebox plugin (IDOK)