[python-win32] win32clipboard & bitmaps

Luke Deller ldeller@xplantechnology.com
Wed, 23 May 2001 17:42:30 +1000


Hi,
I'm having trouble with the win32clipboard module in win32all-138.
I do the following after copying a bitmap image into the clipboard:

$ python
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> import win32clipboard
>>> win32clipboard.OpenClipboard(0)
>>> print
win32clipboard.IsClipboardFormatAvailable(win32clipboard.CF_BITMAP)
1
>>> str = win32clipboard.GetClipboardData(win32clipboard.CF_BITMAP)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
pywintypes.api_error: (6, 'GetClipboardData:GlobalLock', 'The handle is
invalid.
')

Any ideas why I get this exception?  Is this a bug in win32clipboard?  The
clipboard contents will paste correctly into another application (eg
Microsoft Word using "Paste Special" to paste as a regular bitmap)

Thanks!
Luke.