Compartir a través de


SHCreateNewItem (Windows CE 5.0)

Send Feedback

This function creates a new item programmatically, as if an item were chosen from the global New button menu.

**Note   **In Windows Mobile, the new item is created programmatically, as if an item were chosen from the global New drop-down menu.

Syntax

HRESULT SHCreateNewItem(  HWND hwndOwner,  REFCLSID clsid);

Parameters

  • hwndOwner
    [in] Handle to the owner window of the new item.
  • clsid
    [in] Class identifier of the new item.

Return Values

This function returns NOERROR when it is successful.

Remarks

When SHCreateNewItem is called, the OS sends an NMN_INVOKECOMMAND notification message to the window of the application hosting the New button. This gives the application the opportunity to handle the call itself. If the value returned from the hosting application is zero, then the OS calls CoCreateInstance on the CLSID obtained from that menu item's registry setting to instantiate an object representing the new item.

If the object is successfully instantiated, then the OS tries to obtain a pointer to an IPersistPropertyBag:IPersist interface for it by calling IUnknown::QueryInterface on it.

If the object supports the IPersistPropertyBag interface, then the OS sends an NMN_GETPROPERTYBAG notification message to the hosting application. If the application returns a non-zero value from the notification, then the OS uses the IPersistPropertyBag interface to load the property bag returned from the application. Otherwise, the OS calls IPersistPropertyBag::InitNew from the interface it had previously obtained.

If the object does not support the IPersistPropertyBag interface, then the OS queries the object for the INewMenuItemServer interface.

Requirements

Pocket PC: Pocket PC 2000 and later
OS Versions: Windows CE 3.0 and later
Header: aygshell.h
Link Library: aygshell.lib

See Also

NMN_GETPROPERTYBAG | NMN_INVOKECOMMAND | INewMenuItemServer | INewMenuItemServer::CreateNewItem | CoCreateInstance | IUnknown::QueryInterface

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.