Hey everybody,
I get an interesting bug when working with menus. It happens when I try to add a menu item to the menu bar that has both a bitmap (instead of a string) *and* a submenu. If I set it up as having one or the other, no problem. But if I want both, windows replaces the bitmap with the MS Flag (you all know what I mean). I'm not sure if this is specific to NT or not, but that's the OS I'm on at the moment.
Does anyone know how to get around this (well, other than owner drawn)?

Thanks
--Chorus

This is the relevant code:



.data
DocMenu MENUITEMINFO {sizeof MENUITEMINFO,MIIM_TYPE + MIIM_SUBMENU,MFT_BITMAP,\
MFS_ENABLED,NULL,NULL,NULL,NULL,NULL,NULL,NULL}
.code
invoke LoadMenu,hInst,addr MenuName
mov hMenu,eax
invoke LoadBitmap,hInst,IDB_DOC
mov DocMenu.dwTypeData,eax
invoke LoadMenu,hInst,addr SubMenuName
mov DocMenu.hSubMenu,eax
invoke InsertMenuItem,hMenu,0,TRUE,addr DocMenu
Posted on 2002-05-19 18:57:30 by chorus
Try to put it at the second place (instead 0, set 1) then you will see the real bitmap, well, I don't know why !!
Posted on 2002-05-20 06:40:59 by Vom-bonjour:-()
but I don't really understand why you insert a submenu because it's not a submenu in the main menu, it's just another item, maybe you could explain clearly what you want to do...

(sorry if I don't understand exactly)
Posted on 2002-05-20 06:43:19 by Vom-bonjour:-()
Thanks for your reply,

All I really want to do is replace "File" on the menu bar with an image, but still be able to open up the popup menu (to save/open/close, etc). If I try modifying the existing "File" menuitem than it shows the text *and* the bitmap which is very strange... :(


--Chorus
Posted on 2002-05-20 06:58:50 by chorus
could you send me your code, I think I understand your problem, I could help you then...

(by mail or posting code here)
Thomas-Vidal@wanadoo.fr
Posted on 2002-05-20 07:02:52 by Vom-bonjour:-()
BTW, your idea works :) Unfortunately, it's kindof important to me that it be in the first position... And I tried using DeleteMenu after I added it to remove the item before it (trying to trick it you see). However, DeleteMenu doesn't seem to do anything. At all. It won't delete any item off the menu...
Thanks again

--Chorus
Posted on 2002-05-20 07:05:36 by chorus
Make sure you set the third parameter to TRUE. If you put 0 or NULL menu items can appear mysteriously out of order.

invoke InsertMenuItem, hMenu, 0, TRUE, addr item
Posted on 2002-05-21 17:05:40 by grv575
Thanks for your tips guys :)
I got it working, but had to resort to Owner Drawn menus. That's actually fine cause I found I'm going to need it anyways for other things I want to do.

Thanks again

--Chorus
Posted on 2002-05-21 17:46:36 by chorus