Compartir a través de


Displaying and Handling Items in the New Button Menu (Windows CE 5.0)

Send Feedback

In an OS design that supports the AYGShell API extensions, the New button enables users to create new items by means of a selection process. When your application hosts a New button, it has to process or forward messages sent from this menu.

When a user chooses an item from the New button menu, the menu sends a NMN_GETAPPREGKEY notification to the host application. This begins the process of building the menu. If the application returns a valid string, then the shell searches the registry to find New button menu entries supported by the application. For more information, see Adding a Temporary New Button Menu Item. If entries for the application exist, then the shell places a separator in the menu entries and the application's entries are sorted and placed above the separator.

After the application's entries are loaded in the menu, the shell loads the global entries for the New button menu. For more information see Adding a Global New Button Menu Item.

**Note   **If the shell searches the registry and cannot find any global or temporary entries for the New button menu, then the creation process fails.

After the shell loads an application's temporary entries into the New button menu, the application receives menu IDs. When the user chooses a menu item, the shell compares the ID of the menu item against IDM_NEWMENUMAX. If the ID returned from the New button menu is greater than IDM_NEWMENUMAX, then the ID is forwarded to the host application's window and the application creates the new item.

If the ID is less than IDM_NEWMENUMAX, then the shell calls the SHCreateNewItem function with the CLSID that it loaded from the global menu entries in the registry. SHCreateMenuItem sends a WM_NOTIFY message with an NMN_INVOKECOMMAND notification to the application. This gives the application the opportunity to handle the message and create the COM object for the item. In this case, the application should return TRUE to signal that SHCreateMenuItem does not need to instantiate the COM object.

Once the New button menu has sent the ID, the OS sends an NMN_NEWMENUDESTROY notification to the host application, so it can perform any application-specific clean-up actions. Once the OS has sent the notification, it destroys the New button menu.

See Also

Pocket PC-style New Button

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.