问题
there. I'm new to CEFbrowser. I'm developing the download model of My CefBrowser. I've written some code but error while compiling.
class CefClient : public virtual CefBase {
public:
///
// Return the handler for download events. If no handler is returned downloads
// will not be allowed.
///
/*--cef()--*/
virtual CefRefPtr<CefDownloadHandler> GetDownloadHandler(){
return this;
}
But VS2015 says C2440:
"return":cannot convert from 'CefClient *const' to 'CefRefPtr<CefDownloadHandler>'
I'm new. and when i change return this
to return null
it runs, but can't download.
What can i do to solve this problem?
Thank you!
回答1:
It looks like your CefClient
has to inherit from CefDownloadHandler
, i.e. class CefClient: public virtual CefBase, public CefDownloadHandler
: CEF C++ Implementing download handler
Once you inherit from CefDownloadHandler
, returning this
from an instance of CefClient
will fit correctly as a CefRefPtr<CefDownloadHandler>
.
来源:https://stackoverflow.com/questions/62912066/compile-errorc2440using-cefbrowser-vs2015