Share

acdbGetPreviewBitmapFromDwg

C++

ACDB_PORT bool acdbGetPreviewBitmapFromDwg(
    const ACHAR* pszDwgfilename, 
    HBITMAP* pPreviewBmp, 
    HPALETTE* pRetPal
);

File

acdbimageutils.h

Description

This function returns the preview bitmap from a DWG file.

The following sample shows how to use this function:

HBITMAP hBitmap;
HPALETTE hPal;
acdbGetPreviewBitmapFromDwg("foo.dwg", &hBitmap, &hPal);

// Palette
CPalette* oldPal = pDC->SelectPalette(CPalette::FromHandle(hPal),TRUE);
pDC->RealizePalette();

CBitmap bm;
bm.Attach(hBitmap);

CDC dcMem; 
dcMem.CreateCompatibleDC(pDC);

CBitmap *pOldBitmap = dcMem.SelectObject(&bm);
pDC->BitBlt(0, 0, 1000,1000, &dcMem, 0, 0, SRCCOPY);

dcMem.SelectObject(pOldBitmap);

pDC->SelectPalette(oldPal,TRUE );
pDC->RealizePalette();

bm.DeleteObject();
DeleteObject(hBitmap);
DeleteObject(hPal);

Parameters

Parameters Description
pszDwgfilename DWG file name that you want to get the preview bitmap from.
pPreviewBmp Returned bitmap from the DWG.
pRetPal Returned palette used to draw the bitmap correctly.

Was this information helpful?