The “acdbGetPreviewBitmapFromDwg” method returns the HBITMAP of the drawing’s preview image.Here is a sample code to save this preview image as a bitmap.
#include <atlimage.h>
#include <Gdiplusimaging.h>
static void AsdkSavePreviewImage(void)
{
HBITMAP hBitmap;
HPALETTE hPal;
acdbGetPreviewBitmapFromDwg
(
_T("C:\\Temp\\FirstFloor.dwg"),
&hBitmap,
&hPal
);
CBitmap bitmap;
bitmap.Attach(hBitmap);
CImage image;
image.Attach(bitmap);
image.Save(_T("C:\\Temp\\FirstFloor.bmp"), Gdiplus::ImageFormatBMP);
DeleteObject(hBitmap);
DeleteObject(hPal);
}

Leave a Reply to croxeldyfficCancel reply