TChromium vs C++ Builder
Posted: Tue Oct 24, 2017 6:10 pm
I'd like to try your CEF4Delphi component. I'm using C++ Builder XE3. I can't make it work.
I've created a TChromium and TCEFWindowParent component on a TForm. My code is as followed:
I copied all the necessary win32 files to the same location where the executable is published. When running my project TCEFWindowParent is created but nothing else seems to happen. Probably I did something wrong.
Can you please inform me what's wrong? Thank you in advance!
I've created a TChromium and TCEFWindowParent component on a TForm. My code is as followed:
Code: Select all
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
TChromium *Chromium;
TCEFWindowParent *CEFWindowParent;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
CEFWindowParent = new TCEFWindowParent(this);
CEFWindowParent->Parent = this;
CEFWindowParent->Align = alClient;
CEFWindowParent->Visible = true;
Chromium = new TChromium(this);
Chromium->OnAfterCreated = ChromiumAfterCreated;
Chromium->CreateBrowser(CEFWindowParent, "");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ChromiumAfterCreated(System::TObject* Sender, const Ucefinterfaces::_di_ICefBrowser browser)
{
// FOUND THIS CODE IN A SAMPLE FILE. NOT SURE WHAT IT DOES...
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Chromium->LoadURL("https://www.google.com/");
}
//---------------------------------------------------------------------------
Can you please inform me what's wrong? Thank you in advance!