On 18/08/2011 1:02 AM, RuiDC wrote:

import win32clipboard

filename = r"C:\tmp\test.emf"
with open(filename, "rb") as f:
     data = f.read()
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
win32clipboard.SetClipboardData(win32clipboard.CF_ENHMETAFILE, data)
win32clipboard.CloseClipboard()

why do I get the below message?

pywintypes.error: (6, 'SetClipboardData', 'The handle is invalid.')

CF_ENHMETAFILE requires a handle to a metafile, not simply the data. You might like to google for some examples of using this format in any language.

HTH,

Mark
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to