1

I'm trying to call Chromium Dev Tools with this code from dcef3 demos:

procedure TMainForm.actDevToolExecute(Sender: TObject);
begin
  actDevTool.Checked := not actDevTool.Checked;
  debug.Visible := actDevTool.Checked;
  Splitter1.Visible := actDevTool.Checked;
  if actDevTool.Checked then
  begin
    if not FDevToolLoaded then
    begin
      debug.Load(crm.Browser.Host.GetDevToolsUrl(True));

      FDevToolLoaded := True;
    end;
  end;
end;

When i'm running programm, and pressing DevTools button, nothing happens, empty window, empty source code. For Debug im trying this:

showmessage(crm.Browser.Host.GetDevToolsUrl(True));

And it return nothing(empty string). But this code Works Fine in dcef3 guidemo... And not works in my Programm.

Whats a problem?

Here is dcef3 guiclient demo Full Code - http://dumpz.org/589068/

Thanks

Priler
  • 55
  • 1
  • 10

1 Answers1

1

Searching yields a discussion on Google Groups where Henri Gourvest explains that for the dev-tools URL to work, you need to define a debugging port. For example:

CefRemoteDebuggingPort := 9000;

If that doesn't work, then you need to compare your code with the working demo and identify what else you're doing differently.

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467
  • It does work... Just don't forget to specify that value before the `CefLoadLib` function is called; e.g. in the `initialization` section of the unit. – TLama Jul 15 '13 at 17:24
  • I hope so, @Tlama, but since we can't see all the code in the failing project, can't be certain that Priler hasn't already tried that, and that there's something else wrong with the code. – Rob Kennedy Jul 15 '13 at 17:26
  • I could reproduce the problem (with plain vanilla project) and this resolves it... – TLama Jul 15 '13 at 17:28
  • I putting CefRemoteDebuggingPort := 9000; in Form1.Activate procedure, but its still not working, where i should put this code ? – Priler Jul 15 '13 at 17:57
  • You need to assign the variable *before* you create any TChromium instances. Form activation is obviously too late. The demo you linked to assigns the variable in the unit initialization section, so you could try mimicking that. – Rob Kennedy Jul 15 '13 at 17:59
  • Where is initialization section? I'm putting it on Form1.Create procedure, but still nothing... :( – Priler Jul 15 '13 at 18:01
  • You posted a link to the demo code. Look for the initialization section in that code. Or look for the initialization section in the code Henri Gourvest suggested. – Rob Kennedy Jul 15 '13 at 18:02
  • Yeah, it works!!! I put your code in INITIALIZE section and moved some classes and it works!!! Thanks a lot for Helping :) – Priler Jul 15 '13 at 18:13
  • 1
    Anyway, you can specify value between 1024 and 65535; it's not fixed to 9000 (see [`this comment`](https://code.google.com/p/dcef3/source/browse/src/ceflib.pas#345)). – TLama Jul 15 '13 at 18:18