News:

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

Add-Remove Items from Popup Menu

Started by dedndave, January 03, 2011, 10:02:09 PM

Previous topic - Next topic

dedndave

is it easy to add or remove MENUITEM's from a POPUP menu ?
i created the menu in the resource file
can i modify the contents of the menu in the program ?

caseys

i just found this here:

http://www.masm32.com/board/index.php?topic=13149.0

but it has no rc example.


...
CASE WM_INITDIALOG

        invoke CreatePopupMenu
        mov hMenuPop, eax

        invoke AppendMenu, hMenuPop, MF_STRING, 1001, chr$("Option &1")
        invoke AppendMenu, hMenuPop, MF_STRING, 1002, chr$("Option &2")
        invoke AppendMenu, hMenuPop, MF_SEPARATOR, 0, 0
        invoke AppendMenu, hMenuPop, MF_STRING, 1003, chr$("Option &3")
        invoke AppendMenu, hMenuPop, MF_SEPARATOR, 0, 0
        invoke AppendMenu, hMenuPop, MF_STRING, 1004, chr$("Option &4")
        invoke AppendMenu, hMenuPop, MF_STRING, 1005, chr$("Option &5")
...



looks like its not that hard to change menu items =]


and nice example in your masm32 dir:

masm32\examples\exampl01\popup

Uf, never been so hard to understand

jj2007

DeleteMenu and InsertMenuItem are the functions you are looking for, Dave.
See also RemoveMenu - almost identical, but if the item has a submenu, the latter remains active.

dedndave

many thanks guys   :U

man - there is a lot to learn just to make a simple window - lol

hutch--

Dave,

It gets easier once your head stops hurting. (From bashing it against the wall).
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

i dunno
i got some things working - and i understand most of the functions
i am just unfamiliar with how to do this and how to do that
some of the example code i am looking at is buggish - so, i see at as an example of what not to do - lol
i am going to go back to the beginning and take a hard approach
i want to figure out how to create seperate windows for each element in the client area
well - maybe not the menu
but i will get there   :P

Shooter

Quote from: hutch-- on January 04, 2011, 12:01:17 AM
It gets easier once your head stops hurting. (From bashing it against the wall).

That's good to know.
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.