共用方式為


COleClientItem::OnInsertMenus

Called by the framework during in-place activation to insert the container application's menus into an empty menu.

virtual void OnInsertMenus( 
   CMenu* pMenuShared, 
   LPOLEMENUGROUPWIDTHS lpMenuWidths  
);

Parameters

  • pMenuShared
    Points to an empty menu.

  • lpMenuWidths
    Points to an array of six LONG values indicating how many menus are in each of the following menu groups: File, Edit, Container, Object, Window, Help. The container application is responsible for the File, Container, and Window menu groups, corresponding to elements 0, 2, and 4 of this array.

Remarks

This menu is then passed to the server, which inserts its own menus, creating a composite menu. This function can be called repeatedly to build several composite menus.

The default implementation inserts into pMenuShared the in-place container menus; that is, the File, Container, and Window menu groups. CDocTemplate::SetContainerInfo is used to set this menu resource. The default implementation also assigns the appropriate values to elements 0, 2, and 4 in lpMenuWidths, depending on the menu resource. Override this function if the default implementation is not appropriate for your application; for example, if your application does not use document templates for associating resources with document types. If you override this function, you should also override OnSetMenu and OnRemoveMenus. This is an advanced overridable.

For more information, see IOleInPlaceFrame::InsertMenus in the Windows SDK.

Requirements

Header: afxole.h

See Also

Reference

COleClientItem Class

Hierarchy Chart

COleClientItem::OnRemoveMenus

COleClientItem::OnSetMenu