Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/14/2010

Shortcut menu extensions that target Office Mobile applications often process information in clipboard format. The following sample demonstrates code used by such a component.

Note:
Object Identifiers (OIDs) in the piraparameter below, can be used in Pocket Outlook Object Model (POOM) API calls. These API members are declared in the header file Pimstore.h. You can get a handle to a POOM item by calling the IPOutlookApp::GetItemFromOidmethod. Using this reference as an entry point into the POOM, you can then call POOM APIs (for example, IContact::get_Birthdayand ITask::get_StartDate).

For more information on IDataObject, see the Windows Embedded CE topic, IDataObject.

Code Example

The following code example demonstrates how to implement IDataObject.

Note:
To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.
Copy Code
#include "appext.h"   // To access ItemRef and ItemRefArray.

FORMATETC fmt;
STGMEDIUM stgmed;
ItemRefArray * pira;
CEOID oid;

fmt.cfFormat = RegisterClipboardFormat(CFNAME_ITEMREFARRAY);
fmt.lindex = -1;
fmt.dwAspect = DVASPECT_CONTENT;
fmt.tymed = TYMED_HGLOBAL;

((IDataObject*)GetSite())->GetData(&fmt, &stgmed);
pira = (ItemRefArray*)stgmed->hGlobal;
oid = (CEOID)pira->rgRefs[0].pRef;

See Also