Hello DrO,
I am using your MessageBox plugin v0.98 beta 3.
I found two bugs:
1. when I use you plugin in a section twice without pop $0 between them, I get three buttons in the second messagebox. Here an example script:
-------------------------
OutFile "MessageBoxTest.exe"
; Installer sections
Section "-Installation actions" SecInstallation
messagebox::show MB_ICONINFORMATION|MB_DEFBUTTON1 "" "" "test" "Download Now" "Download Later"
; Pop $0 ; without this the next messagebox will have three buttons although only two are defined!!!
messagebox::show MB_ICONINFORMATION|MB_DEFBUTTON1 "" "" "test2" "Download Now" "Download Later"
Pop $0
StrCmp $0 "1" 0 readyTest ; pressed "Download Now"
ExecShell "open" "http://google.com/"
readyTest:
SectionEnd
-----------------------------
2. When I use your plugin in the .onInit function my installer always crashes. Here an example script:
-----------------------------
OutFile "MessageBoxTest.exe"
Section
SectionEnd
Function .onInit
messagebox::show MB_ICONINFORMATION|MB_DEFBUTTON1 "" "" "test" "Download Now" "Download Later"
messagebox::show MB_ICONHAND|MB_DEFBUTTON2 "" "" "and for the special options...$\n" "IDYES" "m12if you can!"
ClearErrors
FunctionEnd
-----------------------------
Could you help me with this bugs or do I have bugs in my scripts.
Thanks in advance and regards
MessageBox with more buttons
114 posts
I too am also experiencing this problem 🙁
because the plugin uses a variable parameter list you need to ensure that the stack is in a 'clean' state otherwise it will start pulling more than it should do (as you've come across). there was a post a few up by kichik about using a terminating parameter to indicate the end of the params.
as for the crash, i've managed to find the source code for 0.98 beta 1. i'm not sure where the beta 3 code is (could be on my old dev machine still...) i'll see if i can at least get the code working again and fix up some of the issues that i'd fixed from b1 to b3 and hopefully the issue you're having as well
-daz
as for the crash, i've managed to find the source code for 0.98 beta 1. i'm not sure where the beta 3 code is (could be on my old dev machine still...) i'll see if i can at least get the code working again and fix up some of the issues that i'd fixed from b1 to b3 and hopefully the issue you're having as well
-daz
How do I apply what Kichik mentioned a few post up? I am not sure although I tried pushing before and after this plugin and failed to work around it 🙁
Also, if you do plan on re-writing the code can you possibly add in support for jumps much like how MessageBox Handles them now?
Thank you DrO, I find the plugin very promising. Thank you again!
Also, if you do plan on re-writing the code can you possibly add in support for jumps much like how MessageBox Handles them now?
e.g. messagebox::show "" "Title" "" "Body" '"B_A" +12' '"B_B" -12' '"B_D" .DONE' I find the idea of $Pop and $StrCmp a bit cumbersome... Do you think you can add in support for jumps right pass the buttons somehow (all on the same line)?Thank you DrO, I find the plugin very promising. Thank you again!
I found this link (http://forums.winamp.com/showthread....212#post935212) in the forums and tried out what Virtlink said. It seems to work as advertised...
LoopAgain:
Pop $R9
IfErrors Done LoopAgain
Done: the post by kichik was a suggestion on how the plugin could be fixed to handle the multiple parameters better.
i've been out of the loop on any real nsis coding for a while so i'm not sure if plugins are able to do what you're asking for with the jumps so i can't say. the other option is to have a quick macro in place to wrap things up for such a case (is something i'd need to look into to see if it's viable or not, etc)
-daz
i've been out of the loop on any real nsis coding for a while so i'm not sure if plugins are able to do what you're asking for with the jumps so i can't say. the other option is to have a quick macro in place to wrap things up for such a case (is something i'd need to look into to see if it's viable or not, etc)
Do you think you can add in support for jumps right pass the buttons somehownot quite sure what you mean by that
-daz
i've managed to get the 0.98 beta 1 code compiling on my machine here at work and that example script doesn't crash for me but beta 3 does so i broke something with beta 3.
i've just added in /end needing to be on the end of a call to the plugin's function which fixes all of the pop fun since i can now at least only process what's needed and not anything else (will have to make sure it's working 100% though before i do anything else with it).
because of the state of the code i'm going to ditch a 1.0 and effectively re-code a fair chunk of it to aim towards a 2.0 since i also want to have the ability to have a checkbox on the bottom of the messagebox for setting as a default action type of thing.
it's going to take a few days for me to get upto speed with the code again but should have at least a fixed working build by the middle of the week 🙂
-daz
i've just added in /end needing to be on the end of a call to the plugin's function which fixes all of the pop fun since i can now at least only process what's needed and not anything else (will have to make sure it's working 100% though before i do anything else with it).
because of the state of the code i'm going to ditch a 1.0 and effectively re-code a fair chunk of it to aim towards a 2.0 since i also want to have the ability to have a checkbox on the bottom of the messagebox for setting as a default action type of thing.
it's going to take a few days for me to get upto speed with the code again but should have at least a fixed working build by the middle of the week 🙂
-daz
What I meant was instead of...
messagebox::show "" "Title" "" "Body" "B_A" "B_B" "B_D"
pop $0
StrCmp $0 1 +12
StrCmp $0 2 -12
StrCmp $0 3 .DONE Something a bit more like this...messagebox::show "" "Title" "" "Body" `"B_A" +12` `"B_B" -12` `"B_D" .DONE` Just keeping it on one line like the traditional MessageBox instead of Popping and StrCmping just to Goto. Just an idea if you're really going to rewrite the code... Thanks Dr0!I have a problem I am not too sure how to get passed. It involves nesting a variable within a temporary !define inside a !macro. Basically, I am trying to create a macro in which I would be able to use relative jumps a bit easier to get around...
I might have mistakes in the code but am unable to test it out fully 🙁
Any help is greatly appreciated on this! Thank you!
!macro messagebox TITLE BODY B1 X1 B2 X2 B3 X3 B4 X4
Pop $R9 # Clear the Stack...
IfErrors 0 -1
messagebox::show "" "${TITLE}" "" "${BODY}" "${B1}" "${B2}" "${B3}" "${B4}"
Pop $1
IntOp $2 $2 + 1
StrCmp $1 $2 ${X$2} -1
!macroend In theory, the above will jump forward perfectly whereas jumping back would require I add on +5. This way though insures the jumps are predictable as where the following leads to a lot of math for relative jumps...!macro messagebox TITLE BODY B1 X1 B2 X2 B3 X3 B4 X4
Pop $R9 # Clear the Stack...
IfErrors 0 -1
messagebox::show "" "${TITLE}" "" "${BODY}" "${B1}" "${B2}" "${B3}" "${B4}"
Pop $1
StrCmp $1 1 ${X1}
StrCmp $1 2 ${X2}
StrCmp $1 3 ${X3}
StrCmp $1 4 ${X4}
!macroend Global jumps are no problem *but* I am really trying to get this to be relatively friendly. My problem in example 1 (line 6) is, I do not know how to nest the variable inside the define... I tried doubling the $, quotes, backslashes and am completely lost as to how to do it... Can anybody shed some light or some better code?I might have mistakes in the code but am unable to test it out fully 🙁
Any help is greatly appreciated on this! Thank you!
how do you include a custom icon, where do you put that icon (dll file) for it to recognised
Anyone?
Dro
Please
Dro
Please
sorry for the delay in reply, real world kept me from a proper browse of the forums yesterday.
the icon needs to be in a resource dll if i remember correctly (the example script uses shell32.dll from memory). i'll try and double-check the code over tonight (if need be i can look at modifying to make a custom build which allows you to specify just a .ico to be used (should be a relatively easy change from what i rememeber of the icon api in windows)
-daz
the icon needs to be in a resource dll if i remember correctly (the example script uses shell32.dll from memory). i'll try and double-check the code over tonight (if need be i can look at modifying to make a custom build which allows you to specify just a .ico to be used (should be a relatively easy change from what i rememeber of the icon api in windows)
-daz
Thanks DrO for the reply,
No need to change it to a ico, (but if you want that would be great), I can easily make icon dll file, I just need to no where to place or extract the dll file too, so it works, I tried placing it in the system32 folder, but it didn't work I just got a blank space where a icon should have been.
That's just messing around with your default script, I'm not really bother about adding more button, it would just be nice if I could place a custom icon in it.
Plus I'm not really sure what to put in the script, whether you can specify a named custom icon as in "fred.dll,0" or does could you specify it as "$INSTDIR\fred.dll,0"
Thanks
Tony
No need to change it to a ico, (but if you want that would be great), I can easily make icon dll file, I just need to no where to place or extract the dll file too, so it works, I tried placing it in the system32 folder, but it didn't work I just got a blank space where a icon should have been.
That's just messing around with your default script, I'm not really bother about adding more button, it would just be nice if I could place a custom icon in it.
Plus I'm not really sure what to put in the script, whether you can specify a named custom icon as in "fred.dll,0" or does could you specify it as "$INSTDIR\fred.dll,0"
Thanks
Tony
you'd need to specify a full path, the reason the shell32 one works is because it's already on the system's default search path
-daz
-daz
ah ok I'll try it thanks mate 🙂
Nah I can't get it to work, I've placed a dll file in the system32 folder, the dll file has 2 icons in it so the full path and icon number (for icon 2) would be "$SYSDIR\fred.dll,2" right?
It didn't work
It frustrating 🙁
It didn't work
It frustrating 🙁
with that dll, open it up in resource hacker for example and look for a [icon group] value in the tree. check which icon group the icon you want to use is in and then use the id of that group. that works ok for me from what i can tell
-daz
-daz
Ah this is why it probably won't work tried opening it with res hacker as you suggested, but Res Hack says its not a win32 executable file I made the dll file with Axialis IconWorkshop
Bugger 🙁
Bugger 🙁
use the attached dll for adding your icons into. it's a valid dll i built in msvc and i tested by manually adding an icon in with resource hacker and it worked for me
-daz
-daz
thank but that didnt work but it gave me an idea, I found a existing dll file it was a file called acctres.dll deleted all the crap out of it leaving two icon and replaced those with my icons
And it works
so thanks
And it works
so thanks
strange, not sure why it wouldn't have worked assuming the icon was fully added and then saved to the dll. as long as it works now then that's the main thing 🙂
-daz
-daz
I'm using LogicLib and I need a custom messagebox nested within some logic. However, this causes the stack to be unable to be in a clean state. I was wondering when their would be a fixed implemented for this? Reading back on this thread I saw that a /end switch was being tested.
Thanks!
EDIT: Also, with my testing, I've noticed that whenever I quit the installer, it seems to give a memory read violation whenever it tries to unload the messagebox dll.
Thanks!
EDIT: Also, with my testing, I've noticed that whenever I quit the installer, it seems to give a memory read violation whenever it tries to unload the messagebox dll.
Solution with extra buttons
Hi,
Am I right that there is no solution for extra buttons still except for manually clearing stack? This is not elegant solution as the stack could keep some values from outer procedure calls.
Hi,
Am I right that there is no solution for extra buttons still except for manually clearing stack? This is not elegant solution as the stack could keep some values from outer procedure calls.
Hi,
I have just tested the messagebox plugin v.098 beta 3 and I found another small bug inside.
I am using Modern UI, and just after the Welcome page, and before the License page agreement shows, I insert a function to display a simple messagebox with a specific title and only a "OK" button (with the plugin).
When clicking, on "Next" (in the Welcome page), then this pops up the messagebox correctly. Then, when I click back (to return to the welcome page), and then "Next" again, this pops up the same messagebox with my "OK" button but also an additional "1" button !!!
Repeating the process another time, will display the messagebox with "2" if I have clicked on "1", etc...
Below is the essential part of the code:
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowLicenseInfo
!insertmacro MUI_PAGE_LICENSE "myLicense.txt"
.
.
.
Function ShowLicenseInfo
messagebox::show MB_TOPMOST "my specific title" \
"" "\
PLEASE NOTE: this is some additional information" \
IDOK
FunctionEnd
Is there something I have done wrong ? Or is it a problem from the plugin ?
I have just tested the messagebox plugin v.098 beta 3 and I found another small bug inside.
I am using Modern UI, and just after the Welcome page, and before the License page agreement shows, I insert a function to display a simple messagebox with a specific title and only a "OK" button (with the plugin).
When clicking, on "Next" (in the Welcome page), then this pops up the messagebox correctly. Then, when I click back (to return to the welcome page), and then "Next" again, this pops up the same messagebox with my "OK" button but also an additional "1" button !!!
Repeating the process another time, will display the messagebox with "2" if I have clicked on "1", etc...
Below is the essential part of the code:
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowLicenseInfo
!insertmacro MUI_PAGE_LICENSE "myLicense.txt"
.
.
.
Function ShowLicenseInfo
messagebox::show MB_TOPMOST "my specific title" \
"" "\
PLEASE NOTE: this is some additional information" \
IDOK
FunctionEnd
Is there something I have done wrong ? Or is it a problem from the plugin ?
Originally posted by lilisbbcOkay, after some investigations, it appears that simply adding Pop $0 at the end of the function solves the problem.
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowLicenseInfo
!insertmacro MUI_PAGE_LICENSE "myLicense.txt"
.
.
.
Function ShowLicenseInfo
messagebox::show MB_TOPMOST "my specific title" \
"" "\
PLEASE NOTE: this is some additional information" \
IDOK
FunctionEnd
Is there something I have done wrong ? Or is it a problem from the plugin ? [/B]
Don't really know why, but well, as long as it works...
Thanks Dr0 for the plugin ! :-)
The reason that happens is that this plugin requires that the stack be empty. The first four elements on the stack will be used as the messagebox buttons.
Does anyone have any idea why a message box with this plugin might not work in certain instances? As the developer of our installer, I have not experienced any issues with it, nor have others who've tested it, but one tester has. I'm using the messagebox::show in 3 separate places, and for him, when he clicks on the button in the custom pages to display these message boxes, nothing happens. I've created this simple script, which duplicates the problem on his machine, but works fine for others and myself. He can see the "normal" message box, but not the MB via the plugin. Any thoughts?
One thing in that script is that you've got InitPluginsDir after MUI_INSTALLOPTIONS_EXTRACT and it should be before.
What happens if you put a normal MessageBox before the plugin MessageBox. Does that get displayed?
-Stu
What happens if you put a normal MessageBox before the plugin MessageBox. Does that get displayed?
-Stu
I updated the InitPluginsDir, and that didn't seem to make a difference (though I will update that in my real code anyway, thanks for pointing it out). I also inserted a normal message box to confirm that we're getting to that place in the code, and it appears. The very next line, the messagebox::show, still doesn't work on his (still does on mine).
On a side note, we're both using our standard company issue workstations with Windows XP Pro SP2.
On a side note, we're both using our standard company issue workstations with Windows XP Pro SP2.
Sorry, meant to update attachment with your suggestions: