0

I used in Delphi XE7 the following code to get frame source in DCEF3:

procedure TForm1.Chromium1LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
var CefStringVisitor:ICefStringVisitor;
begin

    CefStringVisitor := TCefFastStringVisitor.Create(CallbackSource); //<--Error here
    frame.GetSource(CefStringVisitor);
end;


procedure TForm1.CallbackSource(const str: ustring);
begin
    //Do some work
end;

I migrated my project to Delphi XE 10.1 Berlin, and now the same code does not work. The following error occurs:

Incompatible types: 'regular procedure and method pointer',

In the following code snippet:

CefStringVisitor := TCefFastStringVisitor.Create(CallbackSource)
Marcoscdoni
  • 955
  • 2
  • 11
  • 31
  • 1
    As it says, you can't provide a method pointer (a procedure of object) to something expecting a standalone (not attached to object) procedure. IOW, you can't pass `TForm1.CallbackSource` because it's a method pointer. – Ken White Feb 17 '17 at 21:56
  • Thank you Ken White for reply. This is clear. But there is another way to make the code work. – Marcoscdoni Feb 17 '17 at 22:33
  • Yes. Make the procedure standalone (not a member of TForm1). – Ken White Feb 17 '17 at 22:50

0 Answers0