Hi there,

Ok whot i have done is created a menu by using createwindow and specifying the class as #32768, combined with WS_CHILD to have an embedded menu on a window. But the problem is that i have a value in eax which is actually a HWND class. So when i whish to add items to the menu i can't cause GetLastError returns 1401 = INVALID_MENU_HANDLE.

So what i am actually asking is how would i add items to such an menu? Or how would i retrieve a valid HMENU handle to the item, cause it's window class is a popupmenu.

Thank you,
Black iCE
Posted on 2004-07-21 17:16:05 by Black iCE
Just a note, GetMenu doen't work. It gives me a NULL return value.
Posted on 2004-07-21 18:01:22 by Black iCE
Is there a specific reason that you can't use CreatePopupMenu or CreateMenu ? I would assume that CreateWindow would add the menu handle to the wrong handle list and it would not be recognized as a menu by Windows.
Posted on 2004-07-21 19:17:22 by donkey
Well donkey, i tried taking the easy way out by using that method. I wanted a menu-like item that acts like 1 but looks like a normal control. Well i have looked at some samples and i thought that i could possibly embedd a menu into the window client area. I know that all i *really* needed to do is do owner-draw but looks like i will just have to play around some more. Hopefully come up with something that i like.

Black iCE.

PS: Donkey is right - after creating the menu, it became quite useless because nothing really worked with it. Although a popup-menu consists of a window-element and a menu-element embedding the item to look like a control is gonna take some GDI coding and not just a creation trick.
Posted on 2004-07-21 19:34:53 by Black iCE
You can simulate a menu rather easily, it doesn't do alot. You have just to draw the text on a custom control and track the mouse movement, hiliting is a simple task and watching for mouse up/down is all that's really left.
Posted on 2004-07-21 19:39:45 by donkey
My aim was to create something closely similar to the start-menu. Although i could not quit figure out what was involved, i did know that it must not be a pop-up. I have tried taking a listview and process custom drawing, i have considdered toolbars but when working with windows xp the toolbars draw funny cause of the manufest. Hence the post about UxTheme (revived), and well the listview is going ok except i cant get the rec erased after the draw and so i know i mus draw over it with the previous color and so some other things but i thought that mabe there is an esier way out. But anyway donkey, i'll keep on trying. I have Nan's custom control tut and have browsed through it and have started to consider what will be involved to do what i desire. But what irks me kindof is that there are some topics that will take me long to become intermediate skilled with. GDI+ is one of them and i do have some examples on those to - well learning them quite rapidly. And i have looked at xtreme's menu example and thought that mabe with some creation tricks i could add in a menu and using the gidlines addressed by him i could go about and adchieve ny goals with relative ease. The other thing about GDI/GDI+ is that cause all the debugging mainly are involved with window procedures after *events* so trying to get the correct debug-trace while displaying the window is somewhot throuble some. I realise as i have said before that coding i enjoy but the way my gui looks is what irks me to no end. I didn't think it will be easy to start with but i didn't think it will be this difficult at all. I have done most of the algorythm work in my app that now instead of being packed nicly into one - consists of 4 diffrent projects each of diffrent language and purpose in desighn. I have come accross some irritating elements within the masm32 package before - but then in other packages i also find other irritations. I am still at it cause i admit - difficulty in adchieving is what i enjoy. So thank you if you have read this artical so-far.

Black iCE:alright:
Posted on 2004-07-21 20:00:00 by Black iCE
I don't know exactly what you are trying to achieve but the following thread may give you some additional ideas.


Posted on 2004-07-21 21:29:34 by Raymond
The start menu is a special type of menu that is handled by ordinal exports from Shell32.dll. It is not a normal menu. I checked into it once and couldn't get it to work properly but I didn't spend alot of time on it, though I did get the graphic down the side and the large icons. I could not get the InsertItemByPIDL function to work reliably and gave up. You can pretty much do all of that with an owner drawn menu alot easier so it isn't really practical.
Posted on 2004-07-21 21:57:39 by donkey
Raymond thank you for your link and input, you have givn me an idea! Donkey, well i wasn't hoping to replace the start-menu but i agree with the fact that it should a easier to do with an owner-drawn menu. But the aim for now is to have a menu-something act like a menu, but looking better than the system given1.

I just want to know if it can be done - i mean have a static menu embedded within the window like a common control. No popup anything and now sub-menu's. (and i hear every one screaming owner-drawn, *me looking sheepish*)

|Window Title bar
| Item 1 |
| Item 2 |
| ---Seperator---- |
| Item 3 |
| Item 4 |
| |

Tried Toolbar - XP manifest stuffs it up, can't call SetWindowTheme..... doesn't exist and yes well don't really know how make a lib for it.

ListView, slowly getting there.(very slowly) hence thought that i could cheat @ it, by creating the menu though Createwindow.

Anyway, well gonna get some sleep and then stick back into it.

Black iCE
Posted on 2004-07-22 00:15:49 by Black iCE