SHCreateNewItem (Windows Embedded CE 6.0)
1/6/2010
This function creates a new item programmatically, as if an item were chosen from the global New button 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 Value
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
Header | aygshell.h |
Library | aygshell.lib |
Windows Embedded CE | Windows CE 3.0 and later |
See Also
Reference
AYGShell Functions
NMN_GETPROPERTYBAG
NMN_INVOKECOMMAND
INewMenuItemServer
INewMenuItemServer::CreateNewItem