News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

MenuWOW (customize your menus)

Started by lamer, August 15, 2005, 08:31:50 PM

Previous topic - Next topic

lamer

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

GregL

Looks pretty nice lamer, thanks, I'll try it out.  :U

lamer

#2
New upload of MWLib
- fixed incorrect view of system menu (thanks to Chib777)
- changes of menu font are now displayed properly (thanks to Chib777)

ramguru

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, .... }"

lamer

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?


ramguru

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 :)

ramguru

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]

lamer

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.

comrade



ramguru

#10
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]

ramguru

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) :)

lamer

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!

ramguru

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

lamer

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.