This example presents a pop-up menu (loaded from RES.DLL by WinLoadMenu) with the following characteristics: located at (0,50); initialized with mouse button 1 depressed; allowing keyboard and mouse button 1 interaction.

#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);


[Back] [Next]