OnContextCreated and command line

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

OnContextCreated and command line

Postby Pro2x2 » Mon Jan 16, 2017 4:16 am

Hello

how to in OnContextCreated use params from command line ?
Pro2x2
Newbie
 
Posts: 3
Joined: Sun Jan 15, 2017 1:07 pm

Re: OnContextCreated and command line

Postby magreenblatt » Tue Jan 17, 2017 11:10 am

CefCommandLine::GetGlobalCommandLine()
magreenblatt
Site Admin
 
Posts: 12407
Joined: Fri May 29, 2009 6:57 pm

Re: OnContextCreated and command line

Postby Pro2x2 » Tue Jan 17, 2017 12:11 pm

Use run C:\CEF\tests\cefclient\Release\cefclient.exe --sheight=507

// C:\CEF\tests\cefclient\renderer\client_renderer.cc
virtual void OnContextCreated(CefRefPtr<ClientAppRenderer> app,
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Context> context) OVERRIDE {

CefRefPtr<CefCommandLine> command_line = CefCommandLine::GetGlobalCommandLine();
const std::string& sheight = command_line->GetSwitchValue("sheight");

sheight empty line!
Pro2x2
Newbie
 
Posts: 3
Joined: Sun Jan 15, 2017 1:07 pm

Re: OnContextCreated and command line

Postby magreenblatt » Tue Jan 17, 2017 1:18 pm

Ah, my mistake. OnContextCreated is called in the renderer process. You need to implement CefBrowserProcessHandler::OnBeforeChildProcessLaunch. See https://bitbucket.org/chromiumembedded/ ... -arguments
magreenblatt
Site Admin
 
Posts: 12407
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 25 guests