[Win32utils-devel] Getting image size for win32-clipboard
djberg96 at gmail.com
Fri Apr 17 11:42:23 EDT 2009
I'm having some trouble getting the image size for win32-clipboard. The
basic approach is this:
bmi = 0.chr * 44 # BITMAPIFO
handle = GetClipboardData(CF_DIB)
address = GlobalLock(handle)
memcpy(bmi, address, bmi.size)
size_image = bmi[20,4].unpack('L').first # 0 ???
This generally seems to work. I copied a small 24-bit color jpg image into
my clipboard and can validate that the height and width are correct.
However, the size_image always ends up 0.
What am I doing wrong? The docs did mention that 24-bit RGB images might
return 0. If that's the case, how do I get the size?
More information about the win32utils-devel