I want to paste a picture from Paint into my program. My code is:
Code:
HANDLE handle = GetClipboardData( CF_METAFILEPICT );
if ( handle )
{
	METAFILEPICT *mfp = (METAFILEPICT*) GlobalLock( handle ); 
	NumBytes = GlobalSize(  mfp->hMF );
}
When running the program, all the fields of the METAFILEPICT structure are set to reasonable values, but NumBytes is zero. The debugger also says that mfp->hMF is unused. If I ignore this and try to replay the picture nonetheless, my program crashes. I can however paste the same picture into WordPad with no problem. What's wrong with my program?

Another problem is that my program draws using the Direct2D APIs. I can't find an example on the internet of a program that replays a metafile into Direct2D. From the MS documentation I understand that I should use
Code:
SHCreateMemStream()
ID2D1Factory1::CreateGdiMetafile()
ID2D1DeviceContext::DrawGdiMetafile()
What pointer should I pass to SHCreateMemStream?

Any help is greatly appreciated.