INF: Passing METAFILEPICT Structures Through DDE ID Number: Q69883
3.00 WINDOWS
Summary:
When an application sends a WM_DDE_REQUEST message and the server application replies with a WM_DDE_DATA message, the format of the data returned in the Value[] member of the DDEDATA structure is not always the same, but depends on the value of the cfFormat member of the structure.
More Information:
The server application defines the data returned in the Value[] member of the DDEDATA structure. This data must be in one of the formats used to pass data to the Clipboard. The standard clipboard data formats and a description of their data are defined in the documentation for the SetClipboardData() function on pages 4-370 and 4-371 in the “Microsoft Windows Software Development Kit Reference Volume 1”. For example, for the CF_TEXT format, the actual data is returned from the DDE server, and for the CF_BITMAP format, a handle to the bitmap is sent.
The table is not explicit as to what data is returned for the CF_METAFILEPICT data format. The Value[] parameter contains a handle to a global memory block containing a METAFILEPICT structure. To access this structure, call GlobalLock() to get a pointer to the memory and cast the pointer to LPMETAFILEPICT. For example:
LPMETAFILEPICT lpMFP;
lpMFP = (LPMETAFILEPICT)GlobalLock(lpDDEData->Value);
At this stage, the metafile bits may be copied with the following statement:
hMFBits = CopyMetaFile(lpMFP->hMF, NULL);