[Win32utils-devel] Getting image size for win32-clipboard
phasis at gmail.com
Fri Apr 17 19:18:41 EDT 2009
2009/4/18 Daniel Berger <djberg96 at gmail.com>:
> 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?
In my test with mspaint.exe, it works fine.
What's your copy process?
How do I reproduce the bug?
More information about the win32utils-devel