Hello, new to PureBasic, very impressed with it so far.
Check out my first PureBasic program called MsgBox Blaster, which creates the MessageRequester code. (yeah I know the name is a throwback to VB, but MessageRequester Blaster just doesn't have the same ring to it). Thanks to all on this board, a large portion of the code came from some great posts!
I am pretty sure the "Test" feature to display a message is working correctly, but haven't been able to completely run through the "Copy" feature yet. The "copied" code works, but needs to be cleaned up.
I won't be able to work on it for a few days so am throwing it out in case any of you want to try it out. Just let me know if you find any bugs. I am sure there are a few obvious ones that I haven't come across yet.
All Windows standard msgbox features are available as well as the ability to customize the button text. Only thing that isn't straightforward is the Msg Length when you are customizing buttons. There has to be a cleaner way of doing it, I tried to automatically set the MsgLength, but it always ended up being too short. If you customize the buttons, play around with the MsgLength to find the optimum length for your message that doesn't truncate the message. Then take a look at the code that is copied, and let me know if there is a way to calc the msgspace length automatically.
Other then testing out the current features, I'll also be adding an option to add the Select code after the messagerequester. Down the road I may even try building custom Icons.
http://home.comcast.net/~akampmeier/Msgblast.zip
<IMG SRC="http://home.comcast.net/~akampmeier/Screenshotsmall.jpg">
MsgBox Blaster, an easy way to create MessageRequester code
PBDragon,
Very nice tool! It makes the MessageRequester customization that I usually do much easier.
I have a suggestion for a new feature - setting the MessageRequester position. It's easy, just a few additions:
1) Add two Global variables: mbx.l and mby.l
2) Add X.l and Y.l parameters to the MessageBoxH() procedure, so it looks like thisand is called like this
3) Add these statements to the MessageBoxH procedure
4) Add a SetWindowPos_() API call in the MsgBoxHookProc() callback routine, after the SetWindowText_() call
Voila! A customized MessageRequester that you can position anywhere on the screen.
Regards,
Eric
Edit
Ooops, I forgot to give the value of the #SWP constants:
Very nice tool! It makes the MessageRequester customization that I usually do much easier.
I have a suggestion for a new feature - setting the MessageRequester position. It's easy, just a few additions:
1) Add two Global variables: mbx.l and mby.l
2) Add X.l and Y.l parameters to the MessageBoxH() procedure, so it looks like this
Code: Select all
Procedure MessageBoxH (parentWindow, X.l, Y.l, title$, ...)
Code: Select all
MessageBoxH(0, 200, 200, "This is the Title", ...)
Code: Select all
mbx = X
mby = Y
Code: Select all
SetWindowPos_(wParam, 0, mbx, mby, 0, 0, #SWP_NOSIZE|#SWP_NOZORDER)
Regards,
Eric
Edit
Ooops, I forgot to give the value of the #SWP constants:
Code: Select all
; Window API Constants
#SWP_NOSIZE = 1
#SWP_NOMOVE = 2
#SWP_NOZORDER = 4
#SWP_NOACTIVATE = 16
#SWP_SHOWWINDOW = 64
#SWP_HIDEWINDOW = 128
PBDragon,
I just took a closer look at the code generated by your MsgBox Blaster. You can eliminate all of the issues with the message length very easily - just get rid of it!
In the MessageBoxH() procedure, replace the last line
withThis sets the MessageRequester message and title text directly.
Now you can delete the statement and all of the statements too. You can also remove the mbtitle$ and mbmsg$ variables and the code in MessageBoxH() that sets them.
Please let me know if this is what you had in mind, or if I misunderstood something.
Regards,
Eric
I just took a closer look at the code generated by your MsgBox Blaster. You can eliminate all of the issues with the message length very easily - just get rid of it!

In the MessageBoxH() procedure, replace the last line
Code: Select all
ProcedureReturn MessageBox_ (parentWindow, Space (iMsgSpace), Space (iMsgSpace), ibuttontypes | icontype | idefaultbut)
Code: Select all
ProcedureReturn MessageBox_ (parentWindow, message$, title$, ibuttontypes | icontype | idefaultbut)
Now you can delete the
Code: Select all
SetWindowText_ (wParam, mbtitle$)
Code: Select all
SetDlgItemText_ (wParam, #IDPROMPT, mbmsg$)
Please let me know if this is what you had in mind, or if I misunderstood something.
Regards,
Eric
-
- PureBasic Expert
- Posts: 2812
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
Excellent program...
Very usefull !!!
Here's a little optimization for PB:
can be
Very usefull !!!

Here's a little optimization for PB:
Code: Select all
Msg = Msg + Chr(13) + Chr(10)
Code: Select all
Msg + Chr(13) + Chr(10)
Fred, ebs, Num3 thanks for the feedback!
Fred, great idea. I'll probably add options something like
- All Procedures/Constants
- Optimized Procedures/Constants (which would copy only the procedures/constants used in that specific box)
Ebs, also great ideas. I'll play around with your code and let you know how it works.
Num3, didn't know you could do that, thanks for the tip!
Look for a new version which incorporates your ideas sometime late this weekend!
ps... This will always be a free tool, hope it comes in handy for everyone. My way of contributing to this great community!
- All Procedures/Constants
- Optimized Procedures/Constants (which would copy only the procedures/constants used in that specific box)
Ebs, also great ideas. I'll play around with your code and let you know how it works.
Num3, didn't know you could do that, thanks for the tip!
Look for a new version which incorporates your ideas sometime late this weekend!
ps... This will always be a free tool, hope it comes in handy for everyone. My way of contributing to this great community!
Re: Fred, ebs, Num3 thanks for the feedback!
>- All Procedures/Constants
Test your constants, some are already defined in PB
>- Optimized Procedures/Constants (which would copy only the
>procedures/constants used in that specific box)
I would add two options:
*Include all nedded Procedures and constants.
*Insert the call of the current Box
Some notes:
Cancel Try Again Continue don't work on Win9x don't work. When you do this, the programm hangs in a endless loop! Please make a OS-Version Check. ( PB-Function OSVersion() )
Help-> Is it possible to get a message? When not: Remove it, nobody can use it.
And finaly: Do you know jaPBe (when not, look in the announcment-forum). Would be nice, when you make a plugin for jaPBe, so you can kummunikate direct with the editor and you can insert your code direct. Also it is possible to find out, if you are called by jaPBe or not, so the plugin-feature would be optional.
GPI
weekend!
p.s.: Its always nice, when persons open there source-code.
Test your constants, some are already defined in PB
>- Optimized Procedures/Constants (which would copy only the
>procedures/constants used in that specific box)
I would add two options:
*Include all nedded Procedures and constants.
*Insert the call of the current Box
Some notes:
Cancel Try Again Continue don't work on Win9x don't work. When you do this, the programm hangs in a endless loop! Please make a OS-Version Check. ( PB-Function OSVersion() )
Help-> Is it possible to get a message? When not: Remove it, nobody can use it.
And finaly: Do you know jaPBe (when not, look in the announcment-forum). Would be nice, when you make a plugin for jaPBe, so you can kummunikate direct with the editor and you can insert your code direct. Also it is possible to find out, if you are called by jaPBe or not, so the plugin-feature would be optional.
GPI
weekend!
p.s.: Its always nice, when persons open there source-code.