Set URL argument without --url

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.

Set URL argument without --url

Postby themaker » Thu Mar 23, 2017 12:26 pm

Hi,

I'm trying to set my c++ CEF application to start with an URL argument, but without set "--url=".

What I want is to call my application like: ./myapplication www.google.com.br instead of ./myapplication --url=www.google.com.br.

Is there any resource in CEF where I can do that, or should I read args in main function and set the URL with the captured value?

Thank you.
themaker
Newbie
 
Posts: 4
Joined: Wed Feb 22, 2017 12:27 pm

Re: Set URL argument without --url

Postby magreenblatt » Thu Mar 23, 2017 12:45 pm

You can use CefCommandLine::GetArguments to get remaining arguments.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Set URL argument without --url

Postby themaker » Fri Mar 24, 2017 12:44 pm

magreenblatt wrote:You can use CefCommandLine::GetArguments to get remaining arguments.


Thank you, that worked!!

Code: Select all
CefRefPtr<CefCommandLine> command_line = CefCommandLine::GetGlobalCommandLine();
std::vector<CefString> argv = std::vector<CefString>();
command_line->GetArguments(argv);
url = argv[0];  //<- Here's my argument!
themaker
Newbie
 
Posts: 4
Joined: Wed Feb 22, 2017 12:27 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 57 guests