News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

linkig resource issue

Started by Igor_Bezverhi, May 25, 2013, 09:19:30 PM

Previous topic - Next topic

Igor_Bezverhi

hello dear programmers, im using masm32 with the Quick editor 4.0g. im trying to add simple menu to my window but i cant see the menu after assembling and linking. can someone suggest a nice tutorial about adding resources to a window? without a resource editor. just by writing an rc manualy, thanks

TouEnMasm


just use that and modify it
Quote
#include <\MASM32\INCLUDE\RESOURCE.H>


//500 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "MAINICON.ICO"

MAINMENU MENUEX MOVEABLE IMPURE LOADONCALL DISCARDABLE
BEGIN
   POPUP "&file", , , 0
   BEGIN
   MENUITEM "&Exit", 1000
   END
   POPUP "&help", , , 0
   BEGIN
   MENUITEM "&About", 1900
   END
END
Fa is a musical note to play with CL

Igor_Bezverhi

i'l try it, thanks.
i was following a tutorial that had a different sample of the code but it didn't worked correctly.
can you tell me also how to link a manifest.xml file to the resource.. thanks


MichaelW

Quote from: Igor_Bezverhi on May 25, 2013, 09:19:30 PM
im trying to add simple menu to my window but i cant see the menu after assembling and linking.

If you are using the MASM32 batch files and the resource compiler, converter, and linker are not reporting an error, then perhaps the problem is that you have not loaded the resource and assigned the menu to the window.

WindowProc proc hwnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
    SWITCH uMsg
        CASE WM_CREATE
            ;-------------------------------------------
            ; Load the menu resource from the EXE file.
            ;-------------------------------------------
            invoke LoadMenu, hInst, IDM_MENU
            mov hMenu, eax
            ;--------------------------------
            ; Assign the menu to the window.
            ;--------------------------------
            invoke SetMenu, hwnd, hMenu


Also, note that MOVEABLE, IMPURE, LOADONCALL, DISCARDABLE, etc have long been obsolete, and are ignored by Win32.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa380908(v=vs.85).aspx
Well Microsoft, here's another nice mess you've gotten us into.