The MASM Forum Archive 2004 to 2012

Specialised Projects => Custom Interface Components => Topic started by: lamer on August 15, 2005, 08:31:50 PM

Title: MenuWOW (customize your menus)
Post by: lamer on August 15, 2005, 08:31:50 PM
Hi all!
Today I present you my last project – MenuWOW.
I like menus. I like to work with them and to fashion them. For a long time I have intended to write something that will encapsulate all repeated actions (such as hooking and processing menu related messages). So I have created MWLib.dll, a run time library which performs all backstage work. But this library should get the data from the main application, so the data (bitmaps for menu items, colors etc) should be written and stored. OK, I have had no choice – only to develop some designer, which will help to set all needed properties and store them as resource. All you need after – add this *.rc file to your project and write 2-3 lines of code.
Because the files were pretty large, I was obliged to build a small site to store them. You are welcome to download area:
http://lamer.byethost32.com/projects.php

All explanations and credits are in help file – please, read it before you start.
I am waiting for suggestions and bug reports  :(
For those who will say – "Who needs this silliness? I can do it better and more elegant without any stupid program!" – you are absolutely right! I believe you can do it better. But if it will helpful for somebody – it will warrant this post.

Thank you
Title: Re: MenuWOW (customize your menus)
Post by: GregL on August 16, 2005, 03:46:47 AM
Looks pretty nice lamer, thanks, I'll try it out.  :U
Title: Re: MenuWOW (customize your menus)
Post by: lamer on October 05, 2005, 01:14:47 PM
New upload of MWLib
- fixed incorrect view of system menu (thanks to Chib777)
- changes of menu font are now displayed properly (thanks to Chib777)
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on November 02, 2005, 05:46:45 PM
Thanks lamer 4 great menus. BTW it would be nice if your MenuWOW app could produce not only *.RC but additionally also *.bin (myMenu MWSCHEME "res1.bin"). Pelle C resource compiler (PORC) doesn't allow use of something like "myMenu MWSCHEME { 16678788L, .... }"
Title: Re: MenuWOW (customize your menus)
Post by: lamer on November 04, 2005, 05:49:19 PM
Hi, ramguru!
Can you help me a bit?
What is the *.bin? (the only *.bit I know is a CD or DVD image  :P - after all, I'm just a lamer, who try to write something in asm at the free time)
What should it include?
What is its format?

Title: Re: MenuWOW (customize your menus)
Post by: ramguru on November 04, 2005, 06:11:36 PM
Of course I can :) "bin" from binary...it's a binary data.
//--myMenu.bin contents viewed with hex editor

00000000  00 00 00 00 06 00 00 00 00 00 00 00 FF 00 FF 00   ••••••••••••ÿ•ÿ•
00000010  30 30 30 00 FF FF FF 00 FF FF FF 00 08 00 00 01   000•ÿÿÿ•ÿÿÿ•••••
00000020  05 00 00 01 0E 00 00 01 00 00 00 00 11 00 90 01   ••••••••••••••?•
00000030  05 00 00 01 00 00 00 00 FF FF FF 00 00 00 00      ••••••••ÿÿÿ••••

//------------------------------
This file produced with MenuWOW

myMenu MWSCHEME {
/*    Header section    */
0L, //count of menu items with bitmaps
6L, //shapes and selections
0L, //gradient type
/*    Colors section    */
16711935L, //mask color      --FF00FF
3158064L,  //menu back color --303030
16777215L, //selected menu back color --FFFFFF
16777215L, //menu text color          --FFFFFF
16777224L, //selected menu text color --1000008
16777221L, //second menu back color for gradient fill          --1000005
16777230L, //second selected menu back color for gradient fill --100000E
0L, //selected menu frame color
26214417L, //selected menu bitmap frame color --1900011
16777221L, //menu bitmap back color           --1000005
0L, //second menu bitmap back color for gradient fill
16777215L, //selected menu bitmap back color  --FFFFFF
0L, //second selected menu bitmap back color for gradient fill
}

So if I want it to work in Pelles C I must create custom resource (*.bin) and fill it with hex numbers like in hex editor, of course I must convert your numbers to hex, when write them in reverse order :)
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on November 04, 2005, 07:57:55 PM
Ok if you're busy at the moment don't mind my request, besides I've made a little command line utility which does the job rc2bin, but only if there is one scheme (in rc)...

[attachment deleted by admin]
Title: Re: MenuWOW (customize your menus)
Post by: lamer on November 04, 2005, 11:46:15 PM
OK, I think I've get it - just binary data of all parameters, as it was a single structure.
Thanks, I'll try next week.
Title: Re: MenuWOW (customize your menus)
Post by: comrade on November 05, 2005, 12:24:48 AM
screenshots please
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on November 05, 2005, 09:13:06 AM
1-st my favourite
2-nd Pelles C like
3-rd unknown
http://img497.imageshack.us/img497/73/menusamples6qh.png
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on November 05, 2005, 10:06:05 PM
I couldn't help myself and had coded a liittle tool. Now some lines about it:
*there is assigned menu for main window, and of course MWLib.dll is responsible for all drawings
*the most significant feature is that you can choose color values and at the same time see changed menu (not a picture of it)
*you can save scheme in bin and open scheme in bin (to see how it looks like)
...due I'm not perfectly familiar with lamer's RC format some features (bmp, gradient type) aren't implemented, but I can assure you that wysiwyg..
...besides this is just like a feature reaquest for MenuWOW

[attachment deleted by admin]
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on November 06, 2005, 04:58:09 PM
Lamer, I'm sorry for my impatients...this is your thread, however
...but I've made major changes to my tool :)
->Now you can open an exe (or dll) which has only assigned menu(s) & see how lamer's lib will change its menu.
->With "current" menu you are able to do what ever you want (choose custom theme)
->Now you can open an exe (or dll) which holds MWSCHEME (and/or MENU) resource (or many of them) and edit each of them...
->Pressing OK button (in ColorDialog) changes will be saved to exe (dll) if you chose one earlier
->Of course you can save/open *.bin
->Because you can assign whatever menu to main window, none of menu items do something, only buttons
->To choose MWSCHEME or MENU you must double-click listbox item
...now I can say: this project is over :) will wait lamer's word(s) :)
Title: Re: MenuWOW (customize your menus)
Post by: lamer on November 06, 2005, 07:36:23 PM
Hi, ramguru!
Well done! :clap:
I like how you change the resource on the fly!
Unfortunately I could not see how acts MENU, because the program crashes each time I double click on list box - of course, I do something wrong.
I thought I will just add option to save schemes as BIN file - but you prompted me to add "real" menu as preview - so it will take a bit  :green more time than expected.
Two points about saving shemes as BIN:
1. I guess I will save each scheme in separate BIN file
2. If you choose "pattern" fill style for menu - there are two bitmaps (for normal and selected state) stored in MWSCHEME as BMP resource with predefined names:
bubble_p_n BITMAP DISCARDABLE "C:\MenuWOW\Samples\RADAsm\bubble.bmp"
bubble_p_s BITMAP DISCARDABLE "C:\MenuWOW\Samples\RADAsm\bubbledark.bmp"

and after compiling MWLib just loads them as bitmaps. I do not see (for the moment) any way to add them to BIN, as it is just strict coded structure...
Feel free to experiment - it is not at all my own thread.
Thank you for fresh ideas!
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on November 06, 2005, 08:17:29 PM
I want to ask you is this a bug...?
Gradient type values set is [FFFFFF 0 1 ..] not [0 1 ...] so because of that I haven't implemented ability to choose a value in my tool :( this somehow seems to me illogical
Title: Re: MenuWOW (customize your menus)
Post by: lamer on November 06, 2005, 08:57:33 PM
Well, here are gradient type constants:
GRADIENT_FILL_RECT_H    equ 0h
GRADIENT_FILL_RECT_V    equ 1h
these are from MS
GRADIENT_NO equ 0FFFFFFh
GRADIENT_PATTERN_FILL equ 33h

and these are my own.
You can see them in various types of scremes in samples directory in RC file.
Regards.
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on November 06, 2005, 09:12:08 PM
what to expect from MS   :lol
QuoteUnfortunately I could not see how acts MENU, because the program crashes each time I double click on list box - of course, I do something wrong.
OK If I want to see how I can change RadASM menu with lamer's lib I do the fellowing
*Press button "Open exe" and choose Radasm.exe
*Double click on "MENU" listbox item f.e. 998 (now I see RadASM menu in my app)
*I can load a theme: I press "Open bin" and choose "sample_theme2.bin"
this is a screenshot http://img11.imageshack.us/img11/1954/radasmlamrc9zu.png
I use Win XP SP2, maybe this is the issue
I can cause program crash only if I load exe with compressed resource...
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on November 08, 2005, 09:32:50 PM
Quote from: ramguru on November 05, 2005, 10:06:05 PM
I couldn't help myself and had coded a liittle tool. Now some lines about it:
*there is assigned menu for main window, and of course MWLib.dll is responsible for all drawings
*the most significant feature is that you can choose color values and at the same time see changed menu (not a picture of it)
*you can save scheme in bin and open scheme in bin (to see how it looks like)
...due I'm not perfectly familiar with lamer's RC format some features (bmp, gradient type) aren't implemented, but I can assure you that wysiwyg..
...besides this is just like a feature reaquest for MenuWOW
I've updated the tool again :) . Now you are able to choose any bitmap (with size of 32x32 px) at run-time and see how your menu will be updated f.e. like this http://img21.imageshack.us/img21/2597/ss8by.png
Title: Re: MenuWOW (customize your menus)
Post by: lamer on November 09, 2005, 11:46:15 AM
Quote from: ramguru on November 08, 2005, 09:32:50 PM
I've updated the tool again :)
If MenuWOW were commercial project - I should send you an invitation for a full-time job :U
The menus look just nice!
Is it realy me, who has coded all this jazz?  :green2 :green2
Coming soon - preview with "realy" menu in MenuWOW.
ASAP.
Title: Re: MenuWOW (customize your menus)
Post by: lamer on November 22, 2005, 12:23:26 PM
The new versions of MenuWOW and MWLib are ready.
What's new?
MenuWOW:
1.   Added possibility to save each scheme as binary file for subsequent use <OptionsMF OptionsSave schemes as binary file> (see changes in MWLib) – thanks to ramguru.
2.   Added "live" preview – now you can see how your menus will look just at design time ("Preview" window).
MWLib:
1.   Added method for working with binary schemes instead of resources. Obviously, you can still use the resource method. For method calling example see sample from downloads or MenuWOW help file.
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on November 22, 2005, 03:17:46 PM
Thanks 4 quality-application 10 for web 9 for menu-builder (live preview isn't as live as expected - u got to reopen project for preview menu to be updated...maybe this isn't a bug) anyway thanks...
Some recommendation for the long run...
*IMHO vertical grad have not very nice-look, I think you can correct this by implementing reflected gradient effect...
*It would be nice to have ability to define disabled menu state's colors...
These are only suggestions 4 future :)
Title: Re: MenuWOW (customize your menus)
Post by: lamer on November 22, 2005, 08:11:07 PM
Quote9 for menu-builder
How much is it in 100-points scale?  :bg
Quoteu got to reopen project for preview menu to be updated
You change the menu script with another menu editor, MenuWOW can only load it on startup. The only way I see now is to add any button or something else, which will "reload" script on-demand.
Quotereflected gradient effect
Show me!
Quoteto define disabled menu state's colors
Unfortunately, there is no room left in structure for additional colors. It's not a problem to add new members, but new version will be incompatible with old one. If I were MS, I would add some fields (reserved1, reserved2 etc) to structure  :green2 Anyway, I will think about...

Thank you!
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on November 22, 2005, 08:48:43 PM
Quote
How much is it in 100-points scale?  :bg
don't be too greedy in 10p scale of course  :P
Quote
Show me!
here it is - this is what I imagine (I've done this with paint) :) http://img50.imageshack.us/img50/8504/reflected1bi.png
(white->light blue->white transition - in my example...mirror effect..I hope u've understood..what means reflected :))
Title: Re: MenuWOW (customize your menus)
Post by: lamer on November 30, 2005, 06:50:59 PM
Hi all!
There are new upload of MenuWOW - all changes related to new docking windows library.
Title: Re: MenuWOW (customize your menus)
Post by: lamer on December 11, 2005, 05:24:56 PM
Hi all!
New version of MenuWOW uploaded.
What's new:
- menu preview is now really live (every change in bitmaps or menu script is applied to project)
- added two new gradients: horizontal reflected and vertical reflected (thanks to ramguru)
- added button for loading preferable bitmaps editor to edit scheme's bitmap
- user interface changed (new icons)
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on December 11, 2005, 05:49:37 PM
Really WOW, very impressive.  :cheekygreen: I didn't believe you'll implement particular features, but you did it ... thanks. I have not much time (MS 70-320 and much more examx are ahead) to investigate your app now ...I believe it hasn't any critical bugs... Now everything depends on our imagination what we are able to do with your lib :)
Title: Re: MenuWOW (customize your menus)
Post by: lamer on December 13, 2005, 04:17:58 AM
QuoteI believe it hasn't any critical bugs...
Me too... :green2 :green2 :green2
Title: Re: MenuWOW (customize your menus)
Post by: lamer on December 18, 2005, 08:33:52 PM
Hi!
Fixed the stupid little bug (incorrect indexes) wich forced improper appearance of pattern background on buttons at "Settings" window.
Title: Re: MenuWOW (customize your menus)
Post by: lamer on December 30, 2005, 09:33:17 AM
Hi all!
Happy New Year!
As a gift for holiday – new release of MenuWOW.
There are a number of significant changes:
MenuWOW:
1.   Custom settings for grayed menu items - thanks to ramguru for initiative
(the excellent donkey's graphics library is used to gray bitmaps - many thanks!)
2.   Menu transparency
3.   Fixed occasional crash on resource file parsing
MWLib:
1.   The MWSCHEME resource superseded by MWSCHEME_EX
2.   Added MWLInitValuesEx procedure
3.   Added MWLInitValuesBySchemeEx procedure
4.   MWLInitValues and MWLInitValuesByScheme procedures are still available for backward compatibility with previous versions
You can continue to use newly created binaries (*.mwb), but NOT new schemes, with old procedures, but you SHOULD NOT use the old schemes or binaries with new procedures.

The full package now includes "Sample" directory, and "SampleEXE" – a simple executable with run-time library and one binary scheme.
Hope you'll enjoy this release.

Regards

Title: Re: MenuWOW (customize your menus)
Post by: ramguru on December 30, 2005, 02:11:28 PM
Very nice improvements  :clap: ! Keep on !
[what can be fixed]:
In preview window I see menuitem "SEPARATOR" instead of real one (item in rc: "MENUITEM SEPARATOR" produced by ResEd).
[what annoyes me] (may be omitted):
Title: Re: MenuWOW (customize your menus)
Post by: lamer on December 30, 2005, 05:25:36 PM
ramguru
Quote from: lamer on August 15, 2005, 08:31:50 PM
Currently MenuWOW supports (I hope so) menus created by RADAsm and WinAsm.
1. I think I just did not add the word "SEPARATOR" to parsing procedure  :bg
In principle, I can manually replace the "0x00000800" with "SEPARATOR" for testing, but it will be more accurate to work with "real" script.
Could you send me the .rc you work with, please?

2. I think there will be no problem to change dec to hex.

3. Menu with bitmaps - this was a central idea of MenuWOW at the beginning. All other "prettiness" has been added later. But in principle you are right - "bitmapless" menu is quite legitimate. This will take a bit more time than previous points.

Regards
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on December 30, 2005, 05:56:08 PM
OK rc's here http://ramguru.mybesthost.com/menu.txt
BTW how did you set alpha channel of that button. I do know one API (SetLayeredWindowAttributes) that only affects whole window but not only a single child.
Title: Re: MenuWOW (customize your menus)
Post by: lamer on December 30, 2005, 08:11:03 PM
Quote from: ramguru on December 30, 2005, 05:56:08 PM
I do know one API (SetLayeredWindowAttributes) that only affects whole window but not only a single child.
:bg :bg :bg
Indeed.
That's not a child, but popup belongs to other window.
I did not find any way to make a child transparent.
Title: Re: MenuWOW (customize your menus)
Post by: lamer on January 06, 2006, 12:56:14 PM
Hi all!
New upload.
1. Fixed improper parsing separators of menus created by ResEd (for preview window) - thanks to ramguru
2. Added support for "bitmapless" menus - thanks to ramguru for initiative
3. Decimal values in output .RC file replaced with hexadecimal - thanks to ramguru
Title: Re: MenuWOW (customize your menus)
Post by: ramguru on January 06, 2006, 01:52:02 PM
Now RCs look good except those L at the end. IMO you need no Ls
It's hard to tell bad news, but once you fixed one, onother problem came :) take a look http://www.stud.ktu.lt/~ramcvir/miscalc.PNG
If you need project file it's here http://www.stud.ktu.lt/~ramcvir/menu_project.zip
Title: Re: MenuWOW (customize your menus)
Post by: lamer on January 06, 2006, 06:15:39 PM
Quote from: ramguru on January 06, 2006, 01:52:02 PM
It's hard to tell bad news, but once you fixed one, onother problem came :)
Fixed (I hope...)
The road to hell is paved by good intentions :'(
I just wanted the bitmapless menus to look as "usual" menus, without extra space on the left side - but did not check it with all shapes. Thank you.
Quote from: ramguru on January 06, 2006, 01:52:02 PM
IMO you need no Ls
Here is MSDN - about user defined resources
QuoteTo be compatible with 16-bit Windows, integers are stored as WORD values. You can store an integer as a DWORD value by qualifying the integer with the L suffix.
Title: Re: MenuWOW (customize your menus)
Post by: lamer on January 09, 2006, 08:04:14 PM
Hi all!
For those who still uses Win 98 - my apologizes. In the last release, adding transparency, I forgot that SetLayeredWindowAttributes requires at least Win2K.
Fixed in both MenuWOW and MWLib (to all appearances - I have no way to check it on Win 98 - so let me Know) and uploaded.
Thanks to ipadilla
Title: Re: MenuWOW (customize your menus)
Post by: ipadilla on January 09, 2006, 08:24:17 PM
Hi lamer,

MenuWOW is running OK under Windows 98 SE. thank you very much for this up to date.
ipadilla
Title: Re: MenuWOW (customize your menus)
Post by: DC on February 02, 2006, 05:50:45 AM
WOW!
Title: Re: MenuWOW (customize your menus)
Post by: Jojodi on February 02, 2006, 02:56:01 PM
this is absolutely beautiful lol. Is there any way to estimate how much this will inflate an exe? (I am not home at the moment)
Title: Re: MenuWOW (customize your menus)
Post by: lamer on February 02, 2006, 06:28:44 PM
Jojodi,
1. I hope you are back  :bg
2. The .RC file for MenuWOW menu (obvously created with MenuWOW) takes 3 Kb. You can estimate how much will it take in .exe  :green2
3. The .RC of sample project, which includes 16(!) different schemes takes about 20 Kb.
Title: Re: MenuWOW (customize your menus)
Post by: lamer on February 03, 2006, 08:00:27 PM
No news - good news :bg
I've just moved the link of download area to the top of topic and made some cleaning.

Regards
Title: Re: MenuWOW (customize your menus)
Post by: G`HOST on February 18, 2006, 02:25:26 PM
Hi, lamer
Sorry to inform you that whenever i try to create a new project in
MenuWoW i get this error..
QuoteThis program has performed an illegal operation and will be shut down
and when i open an existing example the bitmaps doesnt get loaded.
???
I downloaded the latest version,and had the same problem with the previous version which i downloaded a few months back.
I am runing on "win98"
Can you help me out.
Title: Re: MenuWOW (customize your menus)
Post by: lamer on February 21, 2006, 07:54:49 PM
Hi, G`HOST!
I run out of time at the work now - I'll try to look into the problem when I'll have any pause. As I've mentioned yet, I have no Win98 to test, so it will be very helpfull if you will send me more details (i.e. - what did you do exactly, what button is clicked etc. May be some screenshots). You can just send it as message if you want.

Regards
Title: Re: MenuWOW (customize your menus)
Post by: G`HOST on February 23, 2006, 12:41:32 PM
Hey lamer,
Here goes..

Problem 1.
Image one - The "New project" Dialogbox..
(http://img49.imageshack.us/img49/905/creatingnewimage2qd.th.png) (http://img49.imageshack.us/my.php?image=creatingnewimage2qd.png)

Now after clicking "OK" here is what i get..

(http://img49.imageshack.us/img49/7827/afterclickingok0gj.th.png) (http://img49.imageshack.us/my.php?image=afterclickingok0gj.png)

Problem 2-Open Project
Image 1.
(http://img118.imageshack.us/img118/5877/openproject4ky.th.png) (http://img118.imageshack.us/my.php?image=openproject4ky.png)
after clicking "open" in open dialogbox..
(http://img118.imageshack.us/img118/8964/clickingopen5jt.th.png) (http://img118.imageshack.us/my.php?image=clickingopen5jt.png)
Title: Re: MenuWOW (customize your menus)
Post by: lamer on February 23, 2006, 07:59:24 PM
Hi, G`HOST!
As for second problem - please open files *.mws in notepad and check whether the line:
Bitmaps=C:\MenuWOW\Sample\Sample.bmp
is corresponding with a bitmap real location on your machine.
If it is not - just change it manually.
Title: Re: MenuWOW (customize your menus)
Post by: G`HOST on February 24, 2006, 03:45:46 AM
Yeah it worked but the first problem still persist.
Title: Re: MenuWOW (customize your menus)
Post by: G`HOST on February 24, 2006, 05:19:59 AM
Hi,
Now some problem with the lib itself "I think".
I decided to build the app manually,so exported the SampleMW.rc,
which came with it.Everything worked fine i got what was expected,but when i close the app the screen goes blue with this message on it...
                      WINDOWS
A fatal exception 0E has occured at 017FF:BFF9DFFF
The current application will be terminated.
      Blah..
      Blah..
      Blah..
Press any key to continue.
       "But the Press any key doesnt work.  :("
So i have to poweroff my computer.