bsod when trying to copy canvas to another canvas lazarus / 39-Graphics ---------------------------------------------------------------------- calebs · 2021-03-07 22:13 Hello all. I'm making a program that reprints a ticket and i need to add an qr code to it. I've installed the lazbarcodes component and droped into the form and filled the text property with the values but the problem starts when i try to copy the canvas of the qr to the printer canvas. Always giving me a bsod "apc_index_mismatch win32kfull.sys" im windows 10 pro with lazarus 64 bit Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  var  YPos, LineHeight, VerticalMargin, nro, ancho, posx, xdp, ydp, alto,imaal, imaan, nroi: Integer;  SuccessString, titulos, ftitulos, fcabecerapie, fcuerpo, cad, lin, impresora, scant, sdescr, sprec, nloca, nprov, ncodp: String;  fuente : tfont;  lineas : tstringlist;  ftamano, titulostamano, cabecerapietamano, cabecerapietamano2: LongInt;  enc: Boolean;  rectt, rectqr: TRect;  estilo : TTextStyle;  empresa: tempresa;  desc : real;  prec, ivaa: double; begin    ... more code ...    with Printer do    try      SetPrinter(impresora);      BeginDoc;      fuente:=TFont.Create;      fuente.Name:=ftitulos;      fuente.Color:=clBlack;      fuente.Size:=titulostamano;      fuente.Bold:=true;      canvas.Font:=fuente;      LineHeight := Round(1.2 * Abs(Canvas.TextHeight('I')));      ypos:=0;      canvas.TextOut(5,ypos,empresa.razsoc);      ypos:=ypos+1*LineHeight;    fuente.Name:=fcabecerapie;      fuente.Size:=cabecerapietamano;    fuente.Bold:=false;      canvas.Font:=fuente;      LineHeight := Round(1.2 * Abs(Canvas.TextHeight('I')));      lineas:=TStringList.Create;      cad:=listview1.items[listview1.ItemIndex].SubItems[2];      if (cad=factacte) or (cad=factacon) or (cad=factbcon) or (cad=factbcte) or (cad=factccon) or (cad=factccte) then        lineas.Add('--- FACTURA---')      else if cad=remventa then        lineas.Add('--- REMITO DE VENTA---')      else if cad=pedidoventa then          lineas.Add('---ORDEN DE PEDIDO---');      lineas.Add('CUIT:'+empresa.cuit+' ING.BR:'+empresa.ingbr);      lineas.Add('DRI:'+empresa.dri);      lineas.Add(empresa.domfiscal + ' - TEL:' + empresa.tel1);    ... more code ...      cad:='{"ver":," fecha":"","cuit":,"ptoVta":,"tipoCmp":,"nroCmp":," importe":,"moneda":"","ctz":,"tipoDocRec":';      cad:=cad+',"nroDocRec":,"tipoCodAut":"","codAut":}';    cad:=StringReplace(cad,'','1',[]);      cad:=StringReplace(cad,' ',fechajuntaaiso8601(listview1.items[listview1.ItemIndex].SubItems [7]),[]);      cad:=StringReplace(cad,'',empresa.cuit,[]);      ca d:=StringReplace(cad,'',listview1.Items[listview1.ItemIndex].SubIt ems[2],[]);      cad:=StringReplace(cad,'','001',[]);      cad:=St ringReplace(cad,'',listview1.Items[listview1.ItemIndex].SubItems[2 ],[]);      cad:=StringReplace(cad,'',listview1.Items[listview1.It emIndex].SubItems[4],[]);      cad:=StringReplace(cad,'','PES',[]);      cad:=StringReplace(cad,'','1',[]);      cad:=StringReplace(cad,'','80',[]);      cad:=StringReplace(cad,' ',listview1.Items[listview1.ItemIndex].SubItems[3],[]);      cad:=StringReplace(cad,'','E',[]);      cad:=StringReplace(cad,'< p13>',listview1.items[listview1.ItemIndex].SubItems[6],[]);      BarcodeQR1.Text:=cad;      xdp:=printer.XDPI;      ydp:=printer.YDPI;      imaal:=BarcodeQR1.Canvas.Height;      imaan:=BarcodeQR1.canvas.Width;      ancho:=printer.PaperSize.PaperRect.PhysicalRect.Width;      posx:=10;      alto:=ypos+10;      rectqr:=Rect(0,0,BarcodeQR1.Width-1,BarcodeQR1.Height - 1);      printer.Canvas.CopyRect(rectqr,BarcodeQR1.canvas,rectqr);                        <<< HERE ALWAYS GIVES ME THE BSOD//      canvas.CopyRect(C lasses.Rect(posx,alto,posx+imaan,alto+imaal),BarcodeQR1.Canvas,classes .Rect(0,0, imaan, imaal));    finally      EndDoc;    end;  end;end;                                i still don't have clear how to copy the qr image and put it on the printer canvas at specified position but i was in the middle of the research when this happen. im doing something very very wrong with that sentence? If i remove that line doesnt hang. thanks Ps: if anyone has an example on how can i copy the qr to the printer canvas it would be awesome ---------------------------------------------------------------------- calebs · 2021-03-07 23:03 nevermind... replaced that line with this code and everything works ok. I still like to know what is that i do for cause a bsod everytime with the code above... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i BarcodeQR1. Text:='https://www.afip.gob.ar/fe/qr/?p='+encodestringbase64(cad);     bmp := TBitmap.Create;      R := Rect(0, 0, BarcodeQR1.Width, BarcodeQR1.Height);      r2:= rect(0,ypos+10,BarcodeQR1.Width,ypos+10+BarcodeQR1.Height);      bmp.SetSize(BarcodeQR1.Width, BarcodeQR1.Height);      bmp.Canvas.Brush.Color := clWhite;      bmp.Canvas.FillRect(R);      BarcodeQR1.PaintOnCanvas(bmp.Canvas, R);      canvas.CopyRect(r2,bmp.canvas,r);                   thanks ---------------------------------------------------------------------- ASBzone · 2021-03-07 23:56 Quote from: calebs on March 07, 2021, 11:13:06 pmAlways giving me a bsod "apc_index_mismatch win32kfull.sys" im windows 10 pro with lazarus 64 bit I would suggest that you need to update the video drivers on your system. Which build of Windows 10?    What video card and drivers? ---------------------------------------------------------------------- calebs · 2021-03-17 14:35 sorry for delay... i have win10x64 20h2 19042.867 radeon HD6870 and latest driver available from amd (its very old) But i don't think it was a video driver problem ---------------------------------------------------------------------- wp · 2021-03-17 15:07 You should try to condense your code into a small demo program which shows the issue and which you can upload here. It is much easier to help with support by the compiler.