#496 error in GetClipboardData - handle invalid on GlobalLock

win32 (141)

A long time ago, a user reported problems getting a bitmap from the Windows clipboard: http://mail.python.org/pipermail/python-win32/2001-May/000056.html

The tail end of that thread indicates that the patch was applied, but I see in the current code base, the NotImplementedError is not raised for CF_BITMAP. Instead, if I get the original error if I attempt to get a bitmap from the clipboard:

# after hitting PrtScn to put a bitmap on the clipboard
>>> import win32clipboard as wclip
>>> wclip.OpenClipboard()
>>> result = wclip.GetClipboardData(wclip.CF_BITMAP)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pywintypes.error: (6, 'GetClipboardData:GlobalLock', 'The handle is invalid.')

If win32clipboard doesn't support the CF_BITMAP for GetClipboardData, it should provide a useful message indicating such, rather than a surprising message about an invalid handle.


  • Mark Hammond

    Mark Hammond - 2010-08-30
    • status: open --> closed-fixed
  • Mark Hammond

    Mark Hammond - 2010-08-30

    Added support for CF_BITMAP and a simple test clipboard viewer.

    Checking in src/win32clipboardmodule.cpp;
    new revision: 1.27; previous revision: 1.26
    Checking in Demos/win32clipboard_bitmapdemo.py;
    initial revision: 1.1


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks