Thank you magreenblatt, that did the trick.
As a follow up here is what I did.
Because my CEF Client Handler is derived from "CefClient" in the "OnBeforePopup" function in the handler class I set the "client" to the handler (this).
- Code: Select all
// ClientHandler implementation.
class ClientHandler : public CefClient,
public CefContextMenuHandler,
public CefDisplayHandler,
public CefDownloadHandler,
public CefLifeSpanHandler,
public CefLoadHandler,
public CefRequestHandler
{
...
}
- Code: Select all
bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& target_url, const CefString& target_frame_name, const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings, bool* no_javascript_access)
{
if(browser->GetHost()->IsWindowRenderingDisabled())
{
// Cancel popups in off-screen rendering mode.
return true;
}
// set client to this calls to receive the "OnAfterCreate" calls
client = this;
// The frame window will be the parent of the browser window
HWND hWindow = GetParent( browser->GetHost()->GetWindowHandle() );
// send message
LPCTSTR lpszURL(target_url.c_str());
if( ::SendMessage( hWindow, WM_APP_CEF_WINDOW_CHECK, (WPARAM)&popupFeatures, (LPARAM)lpszURL) == S_FALSE )
return true;
// send message
if( ::SendMessage( hWindow, WM_APP_CEF_NEW_WINDOW, (WPARAM)&popupFeatures, (LPARAM)&windowInfo) == S_FALSE )
return true;
// call parent
return CefLifeSpanHandler::OnBeforePopup(browser, frame, target_url, target_frame_name, popupFeatures, windowInfo, client, settings, no_javascript_access);
}
I have updated the sample CEF MFC App to reflect this.
https://code.google.com/p/cef-mfc/--Scott