Re: bitmap from clipboard to file

"Jim Barry" <[email protected]>
Newsgroups gmane.comp.windows.wtl
Message-ID <3F2F2BC9ADFC4741AA458AE83E122D61@jbarry>
"umeca74" wrote:
> I've been trying to save a window snapshot (32-bit) to a BMP file,
> but the saved image is slightly distorted, it looks like the picture is
> shifted to the right by a few pixels, like this:
> http://img97.imageshack.us/img97/5189/clipboard01e.png
>
> here is the code i use (stripped from error checks). It must be
> something silly I do but after 2 days I can't see what!?

Hi Nikos. It's probably best to avoid GlobalSize, as it may return a larger 
value than the size that was originally passed to GlobalAlloc. However, the 
actual problem is that for a 32-bit screen capture, biCompression is set to 
BI_BITFIELDS, therefore the bmiColors array that follows the header contains 
three DWORD bit-masks, meaning that the pixel data starts 12 bytes after the 
bfOffBits value that you calculated.

- Jim 



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.