在用URLDownloadToFile时, 需要实现IBindStatusCallback接口 的OnPrgess接口,
我定义类,继承了IBindStatusCallback, class CDD : public IBindStatusCallback  
{
public:
 HRESULT OnProgress(ULONG ulProgress,ULONG ulProgressMax,ULONG ulStatusCode,LPCWSTR szStatusText);
CDD();
virtual ~CDD();

};错误信息:
error C2555: 'CDD::OnProgress' : overriding virtual function differs from 'IBindStatusCallback::OnProgress' only by return type or calling convention
        d:\program files\microsoft visual studio\vc98\include\urlmon.h(1124) : see declaration of 'IBindStatusCallback',,为什么????

解决方案 »

  1.   

    看错误是OnProgress函数的返回值和基类中该函数的返回值不一致
      

  2.   

    用CAsyncMonikerFile更简单。
    你这里需要把OnProgress声明为STDMETHODCALLTYPE,不加它时是C++ calling convention
    HRESULT STDMETHODCALLTYPE OnProgress( 
                /* [in] */ ULONG ulProgress,
                /* [in] */ ULONG ulProgressMax,
                /* [in] */ ULONG ulStatusCode,
                /* [in] */ LPCWSTR szStatusText);
      

  3.   

    刚刚在网上下载了一个例子, 可是编译不过去, 大家看看是什么问题??rlfile.obj : error LNK2001: unresolved external symbol "protected: void __thiscall CWinApp::OnHelp(void)" (?OnHelp@CWinApp@@IAEXXZ)urlfile.obj : error LNK2001: unresolved external symbol "protected: static struct AFX_MSGMAP const CWinApp::messageMap" (?messageMap@CWinApp@@1UAFX_MSGMAP@@B)urlfile.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CWinApp::WinHelpW(unsigned long,unsigned int)" (?WinHelpW@CWinApp@@UAEXKI@Z)urlfile.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinApp::OnDDECommand(unsigned short *)" (?OnDDECommand@CWinApp@@UAEHPAG@Z)urlfile.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CWinApp::DoWaitCursor(int)" (?DoWaitCursor@CWinApp@@UAEXH@Z)urlfile.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinApp::DoMessageBox(unsigned short const *,unsigned int,unsigned int)" (?DoMessageBox@CWinApp@@UAEHPBGII@Z)urlfile.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinApp::SaveAllModified(void)" (?SaveAllModified@CWinApp@@UAEHXZ)urlfile.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinApp::InitApplication(void)" (?InitApplication@CWinApp@@UAEHXZ)urlfile.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CWinApp::AddToRecentFileList(unsigned short const *)" (?AddToRecentFileList@CWinApp@@UAEXPBG@Z)
      

  4.   

    可能 有一个源文件没有加入到工程中,你把所有的cpp文件都重新加入到工程
      

  5.   

    把用到的lib加到  project ->setting  里面
      

  6.   

    class CDD 没有实现IUnknown的方法
    参考IBindStatusCallback的定义
      

  7.   

    都已经加入了, 所有的.h , .cpp文件那需要什么lib,  请说明一下??  class CDD 没有实现IUnknown的方法
    参考IBindStatusCallback的定义??? 不懂, IBindStatusCallback的定义很简单, 没有什么可以看的, 
      

  8.   

    IBindStatusCallback有基类的……基类里面也是一堆纯虚函数……