How do I use OnBeforeChildProcessLaunch
Posted: Wed Jul 01, 2020 4:09 pm
I have my c++ app and I have my cef app:
class MyCefApp : public CefApp, CefBrowserProcessHandler
{
void OnBeforeChildProcessLaunch( CefRefPtr<CefCommandLine> command_line )
{
TRACE(L"process launching");
}
}
When I fire up cef, OnBeforeChildProcessLaunch is called for each subprocess launched. But, the input command_line pointer is always nullptr. It looks like I am supposed to implement the method. The cef_browser_process_handler.h file just notes that I should not keep a reference to the |command _line| outside of this method.
I just want to pass my subprocess an arg I can use in the subprocess and I thought this was how to do that but apparently not. I tried the the "ShellExectue" approach of building the subprocess name with the arg I want to pass in but that didn't work as I guess cef tried to kick off the subprocess using the entire string I gave it "myusubprocess.exe /x". I tried both of those because I didn't find any way to pass the arg(s) I want to pass via the CefSettings struct I use to set the subprocess name.
I'm sure this a simple thing to do so don't laugh at me too much.
class MyCefApp : public CefApp, CefBrowserProcessHandler
{
void OnBeforeChildProcessLaunch( CefRefPtr<CefCommandLine> command_line )
{
TRACE(L"process launching");
}
}
When I fire up cef, OnBeforeChildProcessLaunch is called for each subprocess launched. But, the input command_line pointer is always nullptr. It looks like I am supposed to implement the method. The cef_browser_process_handler.h file just notes that I should not keep a reference to the |command _line| outside of this method.
I just want to pass my subprocess an arg I can use in the subprocess and I thought this was how to do that but apparently not. I tried the the "ShellExectue" approach of building the subprocess name with the arg I want to pass in but that didn't work as I guess cef tried to kick off the subprocess using the entire string I gave it "myusubprocess.exe /x". I tried both of those because I didn't find any way to pass the arg(s) I want to pass via the CefSettings struct I use to set the subprocess name.
I'm sure this a simple thing to do so don't laugh at me too much.