I want to paste a picture from Paint into my program. My code is:
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
What pointer should I pass to SHCreateMemStream?

Any help is greatly appreciated.