I am developing an application where in I am storing .png
image to database(SQLite3 used), now as per my requirement, I want the image to be displayed with the ListCtrl Items, so what i need is to Create a CImage object
from the blob data retrieved from the database. My Current approach is every-time I want to display the picture I have to write the file to Disk and then fetch it to the listCtrl item image, I want to get rid of this overhead process. All the experts out their need your help. Please point me to the right direction. I am using VS2010
and MFC
for my application development, Database used SQLITE-3
.
Thanks in advance.
Copy the PNG in a memory block (HGLOBAL). Use CreateStreamOnHGlobal to get an IStream. Than use CImage::Load to get it into the CImage object.
There is no need at all to use a disk file.