home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / DAYFIELD.ZIP / CRMENU.C < prev    next >
C/C++ Source or Header  |  1989-07-21  |  2KB  |  65 lines

  1. /* ----------------------------------------------------------------------
  2. .context CreateMenu
  3. .category PM_Support 4
  4. HWND CreateMenu( HWND hWnd,PUCHAR modname, USHORT id,USHORT x,USHORT y)
  5.  
  6. Description: 
  7.      This Procedure will the load the menu, specified by id, from the
  8. module specified by name, and place it at the location specified by
  9. x, and y;
  10.  
  11.  
  12. Parameter     Description
  13. -------------------------------------------------------------------------
  14. hWnd          a window handle for the owner and parent of the menu
  15.  
  16. modname       32 bit pointer to a zero terminated character string
  17.               specifying the module to get the resource from.  Should
  18.               be the name of the DLL using this call.
  19.  
  20. id            a USHORT specifing the menu to load
  21.  
  22. x,y           USHORT's specifying the x and y location for the menu
  23.  
  24. Returns: 
  25.      a window handle for the new menu
  26.  
  27. Comments: 
  28.  
  29. References: 
  30.  
  31. See Also: 
  32. .ref 
  33.  
  34. Development History: 
  35.   Date         Programmer          Description of modification   
  36.   07/20/1989   Paul Montgomery     Initial development           
  37. -------------------------------------------------------------------- */
  38.  
  39. #define INCL_PM
  40. #include <os2.h>
  41. #include <stdlib.h>
  42.  
  43. HWND CreateMenu( HWND hWnd,HMODULE  hmod, USHORT id,USHORT x,USHORT y)
  44. {
  45.    HWND   hMenu;
  46.    MENUITEM mitem;
  47.  
  48.    hMenu = WinLoadMenu(hWnd, hmod, id );
  49.  
  50.    y += (USHORT) WinQuerySysValue(HWND_DESKTOP,SV_CYMENU) + 1;
  51.    x += 1;
  52.    WinSendMsg(hMenu,MM_QUERYITEM,
  53.       MPFROM2SHORT(WinSendMsg(hMenu,MM_ITEMIDFROMPOSITION,0,0),TRUE),
  54.       &mitem);
  55.     WinSetParent(hMenu,hWnd,FALSE);
  56.     WinSetOwner(hMenu,hWnd);
  57.     WinSetWindowPos(hMenu,HWND_TOP,x,y,0,0,
  58.       SWP_MOVE|SWP_SHOW|SWP_SIZE|SWP_ZORDER);
  59.  
  60.    WinPostMsg(hMenu,MM_STARTMENUMODE,MPFROM2SHORT(TRUE,FALSE),0L);
  61.  
  62.    return(hMenu);
  63. }
  64.  
  65.