Jump to content

WinLoadMenu: Difference between revisions

From EDM2
Created page with " This function creates a menu window from the menu template idMenu from hmod, and returns in hwndMenu the window handle for the created window. ==Syntax== ==Parameters== ;h..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
This function creates a menu window from the menu template idMenu from hmod, and returns in hwndMenu the window handle for the created window.


This function creates a menu window from the menu template idMenu from hmod, and returns in hwndMenu the window handle for the created window.
==Syntax==
==Syntax==
 
WinLoadMenu(hwndFrame, hmod, idMenu)


==Parameters==
==Parameters==
;hwndFrame (HWND) - input
;hwndFrame (HWND) - input:Owner- and parent-window handle.
:Owner- and parent-window handle.
:;HWND_DESKTOP:The desktop window
 
:;HWND_OBJECT:Object window
:;HWND_DESKTOP
:;Other:Specified window.
::The desktop window  
:;HWND_OBJECT
::Object window  
:;Other
::Specified window.  
 
;hmod (HMODULE) - input
;hmod (HMODULE) - input
:Resource identifier.
:Resource identifier.
:;NULLHANDLE:The resource is in the .EXE file of the application.
:;Other:The module handle returned by the DosLoadModule or DosQueryModuleHandle call.
;idMenu (ULONG) - input:Menu identifier within the resource file.
:It must be greater or equal to 0 and less or equal to 0xFFFF.


:;NULLHANDLE
==Returns==
::The resource is in the .EXE file of the application.
;hwndMenu (HWND) - returns:Menu-window handle.
:;Other
::The module handle returned by the DosLoadModule or DosQueryModuleHandle call.  


;idMenu (ULONG) - input
:Menu identifier within the resource file.
:It must be greater or equal to 0 and less or equal to 0xFFFF.
==Returns==
;hwndMenu (HWND) - returns
:Menu-window handle.
==Remarks==
==Remarks==
The menu window is created with its parent and owner set to hwndFrame, and with identity FID_MENU. If hwndFrame is HWND_OBJECT or a window handle returned from WinQueryObjectWindow, the menu window is created as an object window.
The menu window is created with its parent and owner set to hwndFrame, and with identity FID_MENU. If hwndFrame is HWND_OBJECT or a window handle returned from WinQueryObjectWindow, the menu window is created as an object window.


Action bar menus are created as child windows of the frame window and are initially visible. Submenus are initially created as object windows that are owned by the window frame.  
Action bar menus are created as child windows of the frame window and are initially visible. Submenus are initially created as object windows that are owned by the window frame.
 
==Example Code==
==Example Code==
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.
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.
Line 59: Line 50:
                         0, 50, 0,
                         0, 50, 0,
                         flOptions);
                         flOptions);
</pre>
Definition
<pre>
#define INCL_WINMENUS /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>
HWND      hwndFrame;  /*  Owner- and parent-window handle. */
HMODULE    hmod;      /*  Resource identifier. */
ULONG      idMenu;    /*  Menu identifier within the resource file. */
HWND      hwndMenu;  /*  Menu-window handle. */
hwndMenu = WinLoadMenu(hwndFrame, hmod, idMenu);
</pre>
</pre>



Latest revision as of 07:35, 7 August 2023

This function creates a menu window from the menu template idMenu from hmod, and returns in hwndMenu the window handle for the created window.

Syntax

WinLoadMenu(hwndFrame, hmod, idMenu)

Parameters

hwndFrame (HWND) - input
Owner- and parent-window handle.
HWND_DESKTOP
The desktop window
HWND_OBJECT
Object window
Other
Specified window.
hmod (HMODULE) - input
Resource identifier.
NULLHANDLE
The resource is in the .EXE file of the application.
Other
The module handle returned by the DosLoadModule or DosQueryModuleHandle call.
idMenu (ULONG) - input
Menu identifier within the resource file.
It must be greater or equal to 0 and less or equal to 0xFFFF.

Returns

hwndMenu (HWND) - returns
Menu-window handle.

Remarks

The menu window is created with its parent and owner set to hwndFrame, and with identity FID_MENU. If hwndFrame is HWND_OBJECT or a window handle returned from WinQueryObjectWindow, the menu window is created as an object window.

Action bar menus are created as child windows of the frame window and are initially visible. Submenus are initially created as object windows that are owned by the window frame.

Example Code

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

Related Functions