Passing command line arguments into CEF

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.

Passing command line arguments into CEF

Postby mtweeman » Sun Jul 24, 2016 6:24 am

Hi,

I'm working on Start app that can open CEFsimple app and pass some arguments to it. Basically, in Start app I use CreateProcess() function for opening CEF with command line like:
Code: Select all
"\\bin\\cefsimple.exe --allow-file-access-from-files 12345678"

where:
1st arg: location of cefsimple.exe
2nd arg: enabling communication between html files on local drive
3rd arg: password (lame protection)

In CEFsimple I've implemented comparison between password given by Start app and password written in CEFsimple, but it gives wrong results, because actually the program doesn't see arguments that I sent from Start app. Output file of seen args:

args: 14
App1 argument 0: G:\bin\cefsimple.exe
App1 argument 1: --type=renderer
App1 argument 2: --no-sandbox
App1 argument 3: --disable-databases
App1 argument 4: --lang=en-US
App1 argument 5: --lang=en-US
App1 argument 6: --log-file=G:\bin\debug.log
App1 argument 7: --device-scale-factor=1
App1 argument 8: --num-raster-threads=2
App1 argument 9: --content-image-texture-target=3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553
App1 argument 10: --video-image-texture-target=3553
App1 argument 11: --disable-accelerated-video-decode
App1 argument 12: --channel=7076.1.1397704486\1723621388
App1 argument 13: /prefetch:673131151

Any ideas how can I make it works?
mtweeman
Techie
 
Posts: 13
Joined: Tue Mar 22, 2016 4:39 pm

Re: Passing command line arguments into CEF

Postby Czarek » Mon Jul 25, 2016 12:01 am

The output you see is from the renderer process. CEF has multi-process architecture, read more on wiki pages. If you want to pass your argument from the browser process to the renderer process then use the OnBeforeCommandLineProcessing callback. Search forum for examples.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Passing command line arguments into CEF

Postby mtweeman » Tue Jul 26, 2016 2:50 pm

Ok, I'll dig into that.
Are you sure it's the way I should go when I use another executable to open cefsimple?
Btw, mentioned function is not available in cefsimple. Any tips?
mtweeman
Techie
 
Posts: 13
Joined: Tue Mar 22, 2016 4:39 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 80 guests