Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need bitmap data of a document preview through the Windows Shell, but I need packed dib data. The only way I know to do this is by constructing one, but this is a beast of a task for someone who's new to graphics. If anyone can point me in the right direction I would hugely appreciate it.

Here's the steps I'm following so far:

1. Call IExtractImage::Extract to get the HBITMAP handle.
2. Create a DC using CreateCompatibleDC(NULL)
3. Configure a BITMAPINFO struct with the required params for the GetDiBits function to succeed.
4. Call GetDIBits without an output buffer to fill the rest of the BITMAPINFO struct.
5. Copy the BITMAPINFO struct into the buffer. I'm using no compression and the pallete size is zero in the header so I'm assuming the next data that follows is the pixel data.
6. Call GetDIBits again to get the pixel data, storing it into the buffer immediately after the header.

So far the code executes fine, and the data that it extracts is accepted by a host app as a dib, but for some reason it's being cropped off after 20 bytes. I'm not sure what the problem could be, but I want to rule out the possibility that I have the dib format wrong.

Also, if anyone knows of a way that I can easily validate the dib data that I am producing that would be a huge help.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900