hola
tengo este codigo delphi que crea un bitmap.
es una funcion que regresa un bitmap
Código Delphi
[-]
class function TQRCode.GetBitmapImage(const Text: string; Margin,
PixelSize: integer; Level : TErrorCorretion): TBitmap;
var
Bmp : HBITMAP;
DIB: TDIBSection;
ScreenDC : THandle;
DC : THandle;
begin
Bmp := GetHBitmap(PChar(Text), Margin, PixelSize, ord(Level));
GetObject(Bmp, SizeOf(DIB), @DIB);
Result := TBitmap.Create();
Result.Width := DIB.dsBmih.biWidth;
Result.Height := DIB.dsBmih.biHeight;
Result.PixelFormat := pf32bit;
ScreenDC := GetDC(0);
DC := CreateCompatibleDC(ScreenDC);
SelectObject(DC, Bmp);
ReleaseDC(0, ScreenDC);
BitBlt(Result.Canvas.Handle, 0, 0, Result.Width, Result.Height, DC, 0, 0, SRCCOPY);
DeleteDC(DC);
DeleteObject(Bmp);
end;
Al convertirla a C++ Builder me da error.
Código PHP:
TBitmap __fastcall TFrmMainF::GetBitmapImage(String TextoToImgQRCode, int Margin, int PixelSize, int Level )
{
HBITMAP Bmp;
TDIBSection DIB;
THandle ScreenDC;
THandle DC;
String TextoToQR = TextoToImgQRCode;
char *TextoToQRImg = AnsiString(TextoToQR).c_str() ;
Bmp = GetHBitmapA(TextoToQRImg, Margin,PixelSize, Level) ;
GetObjectA(Bmp, sizeof(DIB), &DIB);
Graphics::TBitmap *Result = new Graphics::TBitmap;
Result->Width = DIB.dsBmih.biWidth;
Result->Height = DIB.dsBmih.biHeight;
Result->PixelFormat = pf32bit;
ScreenDC = GetDC(0);
}
el ide de c++ builder como hint, en el editor me indica que ScreenDC es un unsigned int
y que GetDC(0) es una macro __in_opt HWND hWnd
al compilar me sale este error
[bcc32 Error] FrmMainU.cpp(65): E2034
Cannot convert 'HDC__ *' to 'unsigned int'
Full parser context
FrmMainU.cpp(47): parsing: TBitmap _fastcall TFrmMainF::GetBitmapImage(UnicodeString,int,int,int)
que ando haciendo mal. ?
¿como lo puedo solucionar ?
gracias.