save windows clipboard content temporarily and restore later

kakarukeys kakarukeys at
Sat Oct 10 19:24:09 CEST 2009

On Oct 10, 6:00 am, Neil Hodgson <nyamatongwe+thun... at>
> kakarukeys:
> > I followed your hints, and wrote the following code. It works for most
> > clipboard formats except files. Selecting and copying a file, followed
> > by backup() and restore() throw an exception:
>    For some formats the handle stored on the clipboard may not be a
> memory handle so may not be retrieved as memory. You could try using a
> list of formats to include or exclude or just pass over the exception.
>    Neil

The exception occurred not when the program was trying to retrieve the
clipboard data, but when calling SetClipboardData to write to
clipboard. So I don't think what you said is the cause of the problem.

More information about the Python-list mailing list