The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Rainstorm on January 17, 2008, 10:44:54 AM

Title: Menu Template - how to create ?
Post by: Rainstorm on January 17, 2008, 10:44:54 AM
Hi

in the Microsoft SDK they write
QuoteFor information about creating a menu-template resource, see the documentation included with your development tools.
Does this mean the SDK has no documentation on this ? -  & there is no way of doing this with the SDK ? (the template itself)

I found an example of a menu in the examples folder in the masm installation but would appreciate if someone would point me to some documentation on creating these templates/resources.

Thanks for the assistance..

Rainstorm
-
Title: Re: Menu Template - how to create ?
Post by: ramguru on January 17, 2008, 11:13:46 AM
It's here well documented http://msdn2.microsoft.com/en-us/library/ms647567(VS.85).aspx
Title: Re: Menu Template - how to create ?
Post by: zooba on January 17, 2008, 11:26:48 AM
Quote from: Rainstorm on January 17, 2008, 10:44:54 AM
in the Microsoft SDK they write
QuoteFor information about creating a menu-template resource, see the documentation included with your development tools.
Does this mean the SDK has no documentation on this ? -  & there is no way of doing this with the SDK ? (the template itself)

They are probably referring to a menu editor or resource editor rather than typing the entire thing by hand. Assembly language programmers aren't really the target of most of Microsoft's documentation - Visual C++ is.

Cheers,

Zooba :U
Title: Re: Menu Template - how to create ?
Post by: Rainstorm on January 17, 2008, 04:47:23 PM
zooba, ramguru..guys thanks for clearing that up... : )

yah am doing it by hand
Title: Re: Menu Template - how to create ?
Post by: Vortex on January 17, 2008, 07:00:52 PM
Hi Rainstorm,

Here is a method to create and use menu templates.

- Create a resource script with the menu :

Menurc.rc :

#define IDM_ABOUT 11
#define IDM_EXIT 12

10000 MENU
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "&About",IDM_ABOUT
    MENUITEM "&Exit",IDM_EXIT
    END
END


- Compile it using rc.exe and extract the binary menu template data with res2obj :

\masm32\bin\rc Menurc.rc
res2obj Menurc.res Menurc.obj _pMenuTemplate


Menurc.obj is a MS COFF object module including the binary resource data. _pMenuTemplate is a label identifying the menu template. Additionaly, the tool has the capacity to create plain binary ( .bin ) files.

- Load the menu and assign it to the application window :

    .IF uMsg==WM_INITDIALOG
        .
        .
        invoke  LoadMenuIndirect,ADDR pMenuTemplate
        mov     hMenuTemplate,eax
        invoke  SetMenu,hWnd,eax
        .
        .

[attachment deleted by admin]
Title: Re: Menu Template - how to create ?
Post by: Rainstorm on January 18, 2008, 07:27:48 AM
hi vortex,

that was helpful.. thankyou for the example.