Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
On the Windows Mobile-based Pocket PC, a command on the New menu can pass data to the new item, rather than simply creating a blank document. This data might be the time and date, some location information derived from the Global Positioning System (GPS) or another location technology, or something about the context when the user invoked the command on the New menu.
How a Host Application Provides Data
The host application provides data to the command on the New menu by implementing the Windows CE IPropertyBag interface. The host application exposes each of its properties individually. One of these properties must be PropSet, whose value is a string uniquely identifying the set of properties that the property bag provides. Host applications that provide this support should document the property set that they expose so that other applications that interact with them can make use of them.
The host application exposes its property bag by responding to the NMN_GETPROPERTYBAG notification from the shell. This notification will be sent after NMN_INVOKECOMMAND (if the host chooses not to handle the NMN_INVOKECOMMAND itself). A host application must return TRUE from the WM_NOTIFY if it successfully returns a property bag.
How an Object Handler Interprets Data
The object handler implements the Windows CE IPersistPropertyBag interface and reads properties from the host application. The object handler can choose to support as many property sets as it can handle. This means that an object handler can have specific information about other applications. It has the information necessary to read the property sets of a fixed set of applications, and it knows how to translate those properties into a form that its associated application (referred to as the object application) can handle. The object application is the application started by the object handler.
Note An object handler can also support its own native property set — one that is documented by the developers of the object handler. This allows future applications to provide the object handler with data without the object handler being rewritten.
An object handler is no longer required to implement ICreateMenuItemServer if it implements IPropertyBag, but the shell still supports it if it does.
How an Object Application Receives Data
An object application can receive data through whatever mechanism it and its associated object handler arrange. Some common mechanisms are as follows:
- The data is passed on the command line. This is useful for small amounts of data.
- The object handler stores the data in a database, and the record object identifier or primary key is passed on the command line. This is most useful for object applications that already use the database.
- The object handler stores the data in a file and passes the file name to the object application. This is most useful for object applications that already use files.
- There is no object application at all, and the object handler does all the work of creating and displaying the command on the New menu.
See Also
Creating a Global Command for the New Menu
How to: Add Application-Level Commands to the New Button Menu
Send feedback on this topic to the authors.
© 2005 Microsoft Corporation. All rights reserved.