On Fri, 12 Feb 2021 12:51:08 +0100, Luca Olivetti via lazarus <lazarus@lists.lazarus-ide.org> wrote:
>El 12/2/21 a les 11:16, Bo Berglund via lazarus ha escrit: >ing a bogus extra argument as zero but that just changed to a >> different error message... >> >> Application.QueueAsyncCall(@CopyScreenRect, 0); >> >> formmain.pas(149,45) Error: Incompatible type for arg no. 1: Got "<procedure >> variable type of procedure of object;Register>", expected "<procedure >> variable >> type of procedure(Int64) of object;Register>" > >It's telling you that the expected method should have an integer argument >> >> Copyscreenrect looks like this if that matters: >> >> procedure TfrmMain.CopyScreenRect; > >change that to > >procedure TfrmMain.CopyScreenRect(dummy:integer); > >Bye private procedure CopyScreenRect(arg: integer); public ... procedure TfrmMain.miCopyImageClick(Sender : TObject); begin //Sleep(300); //CopyScreenRect; Application.QueueAsyncCall(@CopyScreenRect(0), 0); // <== ERROR here end; procedure TfrmMain.CopyScreenRect(arg: integer); var MyCapture : TBgraBitmap; Clip: TRect; begin try Clip := Bounds(Self.Left, Self.Top, Self.Width, Self.Height); Self.Visible := false; MyCapture := TBgraBitmap.Create(); try MyCapture.TakeScreenShot(Clip); Self.Visible := true; Clipboard.Assign(MyCapture.Bitmap); finally MyCapture.Free; end; except on E: exception do Clipboard.AsText := E.Message; end; end; Now I get this error: formmain.pas(149,31) Error: Variable identifier expected -- Bo Berglund Developer in Sweden -- _______________________________________________ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus