magreenblatt wrote:Did you implement CefApp::GetRenderProcessHandler and pass the CefApp instance to CefExecuteProcess?
Yes, I did, perhaps incorrectly?
- Code: Select all
class my_CEF__application_class : public CefApp, public CefBrowserProcessHandler, public CefRenderProcessHandler
{
public:
CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override
{
return this;
}
CefRefPtr<CefRenderProcessHandler > GetRenderProcessHandler() override
{
return this;
}
void OnContextInitialized() override
{
CEF_REQUIRE_UI_THREAD();
}
private:
IMPLEMENT_REFCOUNTING(my_CEF__application_class);
};
- Code: Select all
int main_init()
{
//......
CefRefPtr<my_CEF__application_callback_class> my_CEF__application_class_;
my_CEF__application_callback_class_ = new my_CEF__application_class;
int ec = CefExecuteProcess(args, my_CEF__application_class_.get(), sandbox_info);
bool my_status_CefInitialize = CefInitialize(args, settings, my_CEF__application_class_.get(), sandbox_info);
}
But, OnContextCreated is still not called:
- Code: Select all
class my_CEF__browser:public CefClient,..., public CefRenderProcessHandler
{
void OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) override
{
std::cout << "OnContextCreated" << std::endl;
}
}