This code will load a menu template from a dll and then use it to add a menu to the frame window hwndFrame which has been previously created without a menu.

HMOD     hmod;
HWND     hwndFrame, hwndMenu;
USHORT   idMenu = 999;
BYTE     lpmt;

DosLoadModule(NULL, 0, "MYDLL.DLL", &hmod);

                       /* Load menu template */
DosGetResource2(hmod, (USHORT)RT_MENU, idMenu, &lpmt);

hwndMenu = WinCreateMenu(hwndFrame, lpmt); /* Create a menu */

DosFreeResource(lpmt); /* free menu template resource */


[Back] [Next]