Important alert: (current site time 7/23/2014 1:25:48 AM EDT)
 

winzip icon

CoolMenu v1.2

Email
Submitted on: 6/10/2000 11:23:37 PM
By: Olivier Martin 
Level: Advanced
User Rating: By 49 Users
Compatibility: VB 5.0, VB 6.0
Views: 50523
 
     See my other submissions to get v1.3

Features:
-Real Office and Visual Studio like icon menus
-Disabled pictures in color (optional)
-Uses the form's font (optional, +size, +color)
-Working "local" and "global" shortcuts (&; Ctrl+?, etc.)
-Easy interfacing between ImageList and VB's Menu Editor
-Event on selection of menu items for context help
-2 ways to display check marks and/or radio buttons
-Full selection of item (bar) or text sel. (text color)
-IE4 hover effect on main menu bar items
-Tested in MDI environement
-Subclass more than one form
-Over 2000 lines (documented) to modify and play with
-Most complete icon menu project ever seen in VB

Based on Paul DiLascia's work from the Microsoft System Journal Ported from VC++ to VB by me + some adaptation. visit www.dilascia.com

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

6/11/2000 12:27:14 AMOmar

Thanks alot for sharing this code.
(If this comment was disrespectful, please report it.)

 
6/11/2000 1:16:15 AMsiph0n

Excellent code! Easy to use. One thing is when you dont use complex checks, and you select one of the checked menu's it will dim the check.
(If this comment was disrespectful, please report it.)

 
6/11/2000 8:04:44 AMtwinny

Great job! thanx!
(If this comment was disrespectful, please report it.)

 
6/12/2000 9:47:51 PMWow!

Does this support scrolling menus? ex.)IE Fav menu bar and Win98 start menu. Great code!
(If this comment was disrespectful, please report it.)

 
6/12/2000 10:31:14 PMOlivier Martin

I'm not sure I see what scrolling menus look like.
To siph0n: selecting a checked item IS suppose to "dim" the check mark background. Actually, Microsoft product use a special pattern for "normal" and the "dim" is the same. Maybe some other time
(If this comment was disrespectful, please report it.)

 
6/12/2000 11:43:49 PMVBDude

this is a really really great piece of work... i'm not bashing anyone's code but vbAccelerator's code is so complex to follow, this one is neat and clean and very well commented to show a newbie how it works... but i was wondering if at possible that this could be put into a activex control with the imagelist compatiblity built-in... so leaving the MS ImageList out of the picture completely...?Please keep up the great work!
(If this comment was disrespectful, please report it.)

 
6/13/2000 9:18:14 AMOlivier Martin

Thank you vbDude. I think the way it is now is the simpliest interface possible. Making it an activeX would just include the ImageList in it and instead of putting the control on the form, you would have to make a reference to the activeX anyway. I don't see the interest but your free to do it for your self. I always prefer inluding re-usable source code then activeX in my projects when possible.
(If this comment was disrespectful, please report it.)

 
6/23/2000 12:02:00 PMRJ Soft of West Tennessee

Very very good code! Now this is some code I can really use. Thank you for uploading it. Keep up the great work.
(If this comment was disrespectful, please report it.)

 
6/26/2000 7:52:57 AMJachym

Thats me again: I've an idea, but I don't know how to do it: how to make a "personalized menu" like from Office 2000 or Windows 2000 (sorry for my English :)
(If this comment was disrespectful, please report it.)

 
7/8/2000 7:50:57 PMDave Dorsey

Ridiculously easy to add to an existing application, and incredibly versatile. Two thumbs up for this tremendous code.
(If this comment was disrespectful, please report it.)

 
7/9/2000 8:04:51 PMTristan

i haven't checked, but did you fix the bug where when you click a menu, it drops down, then you move the mouse off of the top menu and the menu rect goes away when it should stay.. i don't feel like downloading and checking it
(If this comment was disrespectful, please report it.)

 
7/10/2000 12:55:45 AMOlivier Martin

No it's not fixed. All Win98 users have this problem since the very first version but I'm working with W95 and noticed the bug after this release. Won't be able to work on the fix for a while, sorry
(If this comment was disrespectful, please report it.)

 
7/10/2000 3:49:10 AMMitch

Absolutely amazing! Very well done and an excellent job! This would be something that I'd expect to pay for.
(If this comment was disrespectful, please report it.)

 
7/12/2000 12:29:26 AMSeldon

This is incredible code!! Thanks for posting it and providing the helpful comments - this is truly a fantastic piece of programming.
(If this comment was disrespectful, please report it.)

 
7/12/2000 7:22:44 AMBabu

Thanx for this well job u do!
There are lots of codes can help me
learning this greatfull language.
(If this comment was disrespectful, please report it.)

 
7/13/2000 2:29:36 PMSean

Hi VBDude,

The code at vbAccelerator is complex because it is a site for advanced visual basic source code. I think that the menu stuff written by Steve is excellent (I am not saying that this is not good) and the source code can be downloaded from the site (maybe in a different project though).
(If this comment was disrespectful, please report it.)

 
7/13/2000 4:12:33 PMTom Garratt

This code is AMAZING! One minor bug though: When you change the menu caption, the caption comes out as a load of garbage, and the menu icon dissapears.

I have a main menu called 'mnuFile', and a submenu called 'mnuSave', the caption of mnuSave is '&Save...' and has an icon (standard Save icon).

When I click 'mnuFile' I have some code to determine if the thing can be saved or not. If it can, then it enables mnuSave (which works fine), it also changes the caption to '&Save [Another string]'. The Another String is just a filename.

When the caption is changed, the caption is garbage (something like wingdings), and the icon disappears. When you move the move the curser over the menu (mnuSave), then it will chage the caption successfully, but not include an icon.

Please help, I am sure is it only small :)

Thanks for some really great code.
(If this comment was disrespectful, please report it.)

 
7/13/2000 7:57:22 PMHilton

Hi,

When I was using an example in MDI forms, a bug occurs in maximization of child form, like this:

1) some captions of menu disappeared; 2) icons standard (Windows) were replace by another from the program.

Can you elucidate this?

Thanks.


(If this comment was disrespectful, please report it.)

 
7/13/2000 8:01:53 PMTristan

steve from vbaccelerator is so good at API i think he sold his soul
(If this comment was disrespectful, please report it.)

 
7/15/2000 8:12:42 AMJoakim

Great code! Thanks for sharing it :)
(If this comment was disrespectful, please report it.)

 
7/19/2000 5:19:58 AMsivasudheer

why don`t you convert realy cool menu examples from codeguru.com they are far greater than yours they even allow you to customize the toolbars and menubars just like office 97 and vs6.0
(If this comment was disrespectful, please report it.)

 
7/19/2000 5:22:18 AMsivasudheer

can you implement the office 2000 menubar just like word (though it is akward)
(If this comment was disrespectful, please report it.)

 
7/25/2000 10:02:53 PMAndrew Juergens

This is great code. Have you ever considered putting it into an ActiveX control?
(If this comment was disrespectful, please report it.)

 
7/26/2000 9:22:54 AMOlivier Martin

Don't you think that having to distribute the vb runtime files on an host computer is enough garbage ?
An ActiveX would solve a lot of property 'problem' but I won't do it
(If this comment was disrespectful, please report it.)

 
8/3/2000 11:10:55 PMDragonrider15

i'm having a bit of trouble using your code. i insert the code exactly as you have it, except for one change: the name of my imagelist. when i run the program, i get plenty of errors in the debug window, and the menus aren't even there. if you have some info about this, please email it to me. if you'd like, i could zip up an example and send it to you.

thanx,
dragonrider15
(If this comment was disrespectful, please report it.)

 
8/4/2000 8:19:25 AMOlivier Martin

I'd really like to see the example you're proposing. I don't see how you can get those kind of errors. I'm mostly interested in the pictures you're using...
(If this comment was disrespectful, please report it.)

 
8/8/2000 10:44:09 PMBrian Lockwood

Excellent code - easy to implement - one prob. 7 of these " 91 Object variable or With block variable not set WindowProc" every time I close the app. I have it working fine on another form but can't shake these error messages on one form. Depending on how you close your run time - it may take VB down with it when it closes.
(If this comment was disrespectful, please report it.)

 
8/9/2000 3:14:07 AMRob

RE: MDI App
(If this comment was disrespectful, please report it.)

 
8/9/2000 9:26:49 AMOlivier Martin

Brian, if you can't shake them off, send me your code and I'll try finding the problem. I'm sure you realize that I can't help you with the info provided.
(If this comment was disrespectful, please report it.)

 
8/11/2000 4:30:03 AMSteve Ironside

Fantastic code!! This is what code reuse should be about - simple enough to drop in anywhere with virtually no extra work (I'm retrofitting some older applications now!) Great Stuff - thanks for sharing!!
(If this comment was disrespectful, please report it.)

 
8/11/2000 4:33:50 AMSteve Ironside

Fantastic code!! This is what code reuse should be about - simple enough to drop in anywhere with virtually no extra work (I'm retrofitting some older applications now!). It also works brilliantly with Popup and dynamically created menus as well, by the way. Great Stuff - thanks for sharing!!
(If this comment was disrespectful, please report it.)

 
8/11/2000 4:47:06 PMEddie Ferrier

I can't run it! For some reason all the class modules begin with: MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObjectEndAll before the Option Explicit Statement. when i try to run it it correctly states that MultiUse is an invalid outside procedure. I run VB5 SP3
(If this comment was disrespectful, please report it.)

 
8/12/2000 8:31:17 AMOlivier Martin

Eddie, the property you're talking about are the module's property. They should not be added to the code. If you remove all the extra at the beginning of each module, you'll be able to run compile them.
(If this comment was disrespectful, please report it.)

 
8/18/2000 12:28:51 AMDragonrider15

i have a suggestion for your menu code. try putting a picture that runs the full length of the menu down the left-hand side like you see in the windows start menu. if you can get this done, i'd like to know. :o)
(If this comment was disrespectful, please report it.)

 
8/18/2000 4:30:12 PMummmm

i cant figure out how to use the image list control =( ... how do i get icons from my hard drive into the menu.
(If this comment was disrespectful, please report it.)

 
8/20/2000 3:51:16 PMDerek Tremblay

tank you for you code. but 2 major bug occur ..

1: the complex check box in win2000 is white

2: the function END is not functionnal because a crash occur in VB ... please fix it


tank you


ps: sorry for my english i'am french
(If this comment was disrespectful, please report it.)

 
8/29/2000 6:58:07 PMGerbil Fan

I have a fix for the VB End Command - If you have an MDI form, put this code in the unload event:

For T = 1 To Forms.Count - 1
Unload Form(T)
Next T

That code unloads the child forms, and then the MDI form unloads. When all of the forms are unloaded, the program exits normally, and VB does not crash. (Unless you don't uninstall the subclass; then it might crash.)
(If this comment was disrespectful, please report it.)

 
9/1/2000 4:36:44 PMchris

I like your code very much. I applaud you. I have found a bug. The calling sequence is this. The form calls "popupmenu" and then these methods get called in your code:
popupmenu-->WindowProc-->OnInitMenuPopup-->ConvertMenu-->BSTRtoLPSTR-->CopyMemo ry
B(1), ByVal lpsz, cBytes + 2

The line of code above calling "CopyMem" GPFs. In sum when you call your code using popupmenu, a GPF happens, but not everytime. CopyMem blows up, so it's a pretty serious crash. I would be happy to send you a small sample app's source so that you can reproduce the behavior. I've tested on NT4(sp6) and win98. I'm sorry to report a bug in what is really terrific API programming, but I honestly don't know how to fix it, even though I've tried for a few weeks. There are real world scenarios where this will be a problem. TIA
(If this comment was disrespectful, please report it.)

 
9/1/2000 7:22:51 PMOlivier Martin

That's a big problem but could be easy to fix. I don't remember in what kind of conditions it happens, but the memory area where the data is copied from is not always text. That's why you're CoolMenu crashes. Could you send a screenshot of the menu (subclassed if you can, or in the IDE) to my e-mail.
(If this comment was disrespectful, please report it.)

 
9/6/2000 7:18:33 PMMatt

Will you have a new version out soon that will fix the check bug where the colors are different on each version on Win xx?
(If this comment was disrespectful, please report it.)

 
10/4/2000 6:43:45 PMMark

Great code! One problem for me: I don't get the callback on a popupmenu when the menu is set to invisible. When visit, the callback works fine. If you know a workaround, please let me know!
(If this comment was disrespectful, please report it.)

 
10/9/2000 7:13:20 PMBrent

THIS IS GREAT!
(If this comment was disrespectful, please report it.)

 
11/23/2000 11:46:15 AMTim

Impressive code - turns 'blah' to 'YAY' in seconds. :) I always find myself back at PSC to grab this code whenever I'm making an app to be distributed. WTG!
(If this comment was disrespectful, please report it.)

 
2/4/2001 2:12:44 PMBill

Does this REALLY work in VB 5? It tells me that retained is an invalid key.
(If this comment was disrespectful, please report it.)

 
3/22/2001 3:33:58 PMGreg C.

If this code is in a OCX control It would not crash if you push the
(If this comment was disrespectful, please report it.)

 
9/27/2001 12:45:06 PMMohammad

Very Unprofessional but it is very creative, i'll vote Good fer it
(If this comment was disrespectful, please report it.)

 
5/15/2002 6:02:03 PMTim Sørensen

I use this in a MDI form.
When I maximize a MDI Child, and the little extra icon appears in the upper left corner and i move the mouse through the menus, an error 457
appears. "This key has allready been assigned..."

The error is in "CMyItemDatas" Function Add() mCol.Add objNewMember, sKey.

How do I work around?
(If this comment was disrespectful, please report it.)

 
6/21/2002 10:26:06 AMOpenBrowser Developer

Great! Thanks for share your code.


(If this comment was disrespectful, please report it.)

 
9/26/2002 4:52:45 AM

I would love to thank you so much. You share a code that I have found for along time.
Well Dond ! Keep working
(If this comment was disrespectful, please report it.)

 
10/10/2003 10:04:08 AM

I've used your MDI App that works fine, but when occurs any error in the MDIChild the program ends without any error message.
It's only occur when the App is running Exe Mode.
What's happen ???

thanks..
(If this comment was disrespectful, please report it.)

 
10/10/2003 10:04:45 AM

've used your MDI App that works fine,
but when occurs any error in the
MDIChild the program ends without any
error message.
It's only occur when
the App is running Exe Mode.
What's
happen ???

thanks..
(If this comment was disrespectful, please report it.)

 
5/16/2004 3:49:27 PMDrumbeats

Hello, I tried to test your code on win 98 and it seems to get in a loop that displays an error related to the winproc and can't get the code to end without finishing vb, Could you help me. Best regards
(If this comment was disrespectful, please report it.)

 
4/20/2005 10:01:28 AM

It was the most amazing code I have ever seen!!!
(If this comment was disrespectful, please report it.)

 
12/8/2005 3:02:17 AMsamath

Hi all gentle men all your code it is very wonderfull
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.