Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!samsung!uunet!mcsun!ukc!axion!cat.fulcrum.bt.co.uk!nott-cs!christopher-robin.cs.bham.ac.uk!nhj From: nhj@cs.bham.ac.uk (Nick Jurascheck ) Newsgroups: comp.windows.ms Subject: Re: copying metafile to clipboard Message-ID: <929@christopher-robin.cs.bham.ac.uk> Date: 16 Jan 90 16:23:07 GMT References: <22139@usc.edu> Reply-To: nhj@christopher-robin.UUCP (Nick Jurascheck ) Organization: University of Birmingham, England Lines: 25 In article <22139@usc.edu> you write: > I've been trying to copying metafiles to "disk files" with no problem, > while I had no success with copying a metafile to the Clipboard. The > clipboard recognizes that it received a Picture, but nothing is shown. > The following is the sample code I use, mainly taken verbatim from > Charles Petzold book "Programming Windows". When SaveClip is false, > the etafile is correctly saved on a disk file. When SaveClip is > true an "empty" picture shows up in the clipboard. Any ideas? Yes. The code you gave is correct except that you deleted the metafile handle after copying the metafile to the clipboard. Remove this line and you should be OK: > DeleteMetaFile(hMF); Like the global memory handle you pass to the clipboard, the handle to the metafile (hMF) is no longer valid in your program and will be freed by the clipboard (or to be more exact the Windows kernel, since the clipboard is just a global memory area). Nick JANET: JurascheckNH@uk.ac.bham.cs | UUCP: ...!mcvax!bhamcs!JurascheckNH BITNET: JurascheckNH%cs.bham.ac.uk@ukacrl.bitnet INTERNET: JurascheckNH%cs.bham.ac.uk@cunyvm.cuny.edu