How to Implement IDataObject
Shortcut menu extensions that target Office Mobile applications often process information in clipboard format. The following sample demonstrates code used by such a component.
|Object Identifiers (OIDs) in the pira parameter 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::GetItemFromOid method. Using this reference as an entry point into the POOM, you can then call POOM APIs (for example, IContact::get_Birthday and ITask::get_StartDate).|
For more information on IDataObject, see the Windows Embedded CE topic, IDataObject.
The following code example demonstrates how to implement IDataObject.
|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.|
#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.pRef;