This example creates a menu window from the menu template (idMenuId) located in "RES.DLL" and returns a menu handle which is used by WinPopupMenu.
#define INCL_WINWINDOWMGR /* Window Manager Functions */ #define INCL_WINMENUS /* Window Menu Functions */ #include <os2.h> HWND hwndMenu; /* Menu window */ HWND hwndOwner; /* Owner window */ HMODULE hmodDLL; /* resource handle */ ULONG idMenuid; /* Resource menu id */ BOOL fSuccess; /* Success indicator */ HWND hwndParent; /* Parent window */ ULONG flOptions; /* Pop-up menu options */ if (DosQueryModuleHandle("RES.DLL",&hmodDLL)) hwndMenu = WinLoadMenu(hwndOwner, hmodDLL, idMenuid); flOptions = PU_MOUSEBUTTON1DOWN | PU_KEYBOARD | PU_MOUSEBUTTON1; fSuccess = WinPopupMenu(hwndParent, hwndOwner, hwndMenu, 0, 50, 0, flOptions);