使用CEFbrowser&编译错误(C2440) VS2015 [英] Compile Error(C2440)Using CEFbrowser & VS2015

查看:229
本文介绍了使用CEFbrowser&编译错误(C2440) VS2015的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有。我是CEFbrowser的新手。
我正在开发My CefBrowser的下载模型。
我写了一些代码,但是编译时出错。

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;
  }

但是VS2015表示C2440:

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!

推荐答案

您的 CefClient 必须从 CefDownloadHandler 继承,即类CefClient:公共虚拟CefBase,公共CefDownloadHandler CEF C ++实现下载处理程序

It looks like your CefClient has to inherit from CefDownloadHandler, i.e. class CefClient: public virtual CefBase, public CefDownloadHandler: CEF C++ Implementing download handler

一旦您从 CefDownloadHandler ,从 CefClient 的实例返回 this 将正确地作为 CefRefPtr< CefDownloadHandler>

Once you inherit from CefDownloadHandler, returning this from an instance of CefClient will fit correctly as a CefRefPtr<CefDownloadHandler>.

这篇关于使用CEFbrowser&amp;编译错误(C2440) VS2015的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆