Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all articles
Browse latest Browse all 3212

XE10 C++ Builder ilink64 error is reported for GetDIB

$
0
0

XE10 C++ Builder ilink64 error is reported for GetDIB and GetDIBSizes but works in ilink32.

It there a work around for this issue.

 

   Graphics::TBitmap *FormImage = GetFormImage();

try {

SIZE const form_size = {frmMainForm->Width, frmMainForm->Height};

HDC const hScreenDC = GetDC(0);

FormImage->Handle = CreateCompatibleBitmap(hScreenDC, form_size.cx,

form_size.cy);

HPALETTE hPal = NULL;

if ((GetDeviceCaps(hScreenDC, RASTERCAPS) & RC_PALETTE) &&

(GetDeviceCaps(hScreenDC, SIZEPALETTE) == 256)) {

const std::size_t size =

sizeof(LOGPALETTE) + 255 * sizeof(PALETTEENTRY);

unsigned char* const pBuffer = new unsigned char[size];

LPLOGPALETTE pPal = reinterpret_cast(pBuffer);

pPal->palVersion = 0x300;

pPal->palNumEntries = 256;

GetSystemPaletteEntries(hScreenDC, 0, 256, pPal->palPalEntry);

hPal = CreatePalette(pPal);

delete[]pBuffer;

}

ReleaseDC(0, hScreenDC);

if (hPal != NULL) {

FormImage->Palette = hPal;

}

HDC const hWindowDC = GetWindowDC(frmMainForm->Handle);

BitBlt(FormImage->Canvas->Handle, 0, 0, FormImage->Width,

FormImage->Height, hWindowDC, 0, 0, SRCCOPY);

// --------------------------------------------------------

unsigned int iInfoHeaderSize = 0;

unsigned int iImageSize = 0;

GetDIBSizes(FormImage->Handle, iInfoHeaderSize, iImageSize);

BITMAPINFO *pBitmapInfoHeader;

pBitmapInfoHeader = new BITMAPINFO[iInfoHeaderSize];

unsigned char *pBitmapImageBits;

pBitmapImageBits = new unsigned char[iImageSize];

GetDIB(FormImage->Handle, FormImage->Palette, pBitmapInfoHeader,

pBitmapImageBits);

// --------------------------------------------------------

ReleaseDC(frmMainForm->Handle, hWindowDC);

Clipboard()->Assign(FormImage);

TPrinter *Prntr = Printer();

TRect r = Rect(200, 200, Prntr->PageWidth - 200,

Prntr->PageHeight - 200);

Prntr->BeginDoc();

Prntr->Canvas->Font->Size = 7;

float fPrinterVert = (float)GetDeviceCaps(Printer()->Handle, VERTRES);

float fPrinterHorz = (float)GetDeviceCaps(Printer()->Handle, HORZRES);

scale = FMIN((fPrinterHorz / form_size.cx),

(fPrinterVert / form_size.cy));

int iHeight = form_size.cy * scale - 400;

int iWidth = form_size.cx * scale - 400;

int iStartY = 200;

int iLineHeight = Prntr->Canvas->TextHeight(" ");

Prntr->Canvas->Brush->Color = clWhite;

iStartY = Prntr->Canvas->PenPos.y + iLineHeight;

StretchDIBits(Printer()->Canvas->Handle, 200, iStartY, iWidth, iHeight,

0, 0, FormImage->Width, FormImage->Height, pBitmapImageBits,

pBitmapInfoHeader, DIB_RGB_COLORS, SRCCOPY);

iStartY = iStartY + iHeight;

Prntr->Canvas->Brush->Color = clBlack;

Prntr->Canvas->FrameRect(r);

Prntr->Canvas->Brush->Color = clWhite;

Prntr->EndDoc();

}

__finally {

delete FormImage;

}

}

 

[ilink64 Error] Error: Unresolved external 'Vcl::Graphics::GetDIBSizes(HBITMAP__*, unsigned int&, unsigned int&)' referenced from D:\MLSO_DESIGN_2016\DEBUG_BUILD\MAINFORM.O

[ilink64 Error] Error: Unresolved external 'Vcl::Graphics::GetDIB(HBITMAP__*, HPALETTE__*, void*, void*)' referenced from D:\MLSO_DESIGN_2016\DEBUG_BUILD\MAINFORM.O

 


Viewing all articles
Browse latest Browse all 3212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>