I have a program that loads a DLL using LoadLibrary, then uses GetProcAddress to retrieve a ptr to a function that is supposed to add the DLL menu to the programs menu bar. The program window handle is passed to the DLL function so it can retrieve the menu handle. The DLL menu is defined in a RC file, compiled with the DLL, and loaded using LoadMenu. The menu is being loaded correctly because I can use SetMenu to replace the program menu with the DLL menu, but I want the DLL menu to be added to the program menu bar so I can access the DLL functions from the program.


#include <resource.h>

#define MESH_ID 1024
#define MESH_ADD 1025
#define MESH_REMOVE 1026

MESH_ID MENU DISCARDABLE
BEGIN
  POPUP "Mesh"
  BEGIN
    MENUITEM "Add", MESH_ADD
    MENUITEM "Remove", MESH_REMOVE
  END
END


How do I add the DLL menu to the program menu? AppendMenu or InsertMenuItem?
Do I need to create a popup menu first? or will it automatically be created since it's a resource?
My attempts so far only lead to a seperator bar being drawn :mad:
Posted on 2007-01-15 00:48:16 by Maelstrom
AppendMenu - Appends a menu item to THE END OF a given menu.
InsertMenu - Inserts a menu item at GIVEN POSITION in given menu.
Posted on 2007-01-15 04:03:20 by Homer
hSubMeshMenu=GetSubMenu(hDllMeshMenu)
invoke InsertMenu,hMainWindowMenu,0,MF_STRING or MF_BYPOSITION or MF_POPUP,hSubMeshMenu,T('SubMesh')

with GetSubMenu you get the dropdown mnu.
Posted on 2007-01-15 16:32:24 by drizz
Thanks drizz :thumbsup:
I haven't played with menus for quite some time and forgot what I was doing :oops:
Posted on 2007-01-15 16:51:32 by Maelstrom