在普通应用程序中这样写是正确的URLDownLoadToFile(nil, PChar('http://xxx/a.zip), PChar('c:\a.zip'), 0, nil),但如果在编写activex控件中使用此函数时,第一个参数不能用nil(也不能用0),不知那位高手知道该怎么写。以下是URLDownLoadToFile函数的参数说明:
SyntaxHRESULT URLDownloadToFile(          
    LPUNKNOWN pCaller,
    LPCTSTR szURL,
    LPCTSTR szFileName,
    DWORD dwReserved,
    LPBINDSTATUSCALLBACK lpfnCB
);ParameterspCaller:
  Pointer to the controlling IUnknown interface of the calling Microsoft® ActiveX® component (if the caller is an ActiveX component). If the calling application is not an ActiveX component, this value can be set to NULL. Otherwise, the caller is a Component Object Model (COM) object that is contained in another component (such as an ActiveX control within the context of an HTML page). This parameter represents the outermost IUnknown of the calling component. The function attempts the download within the context of the ActiveX client framework and allows the caller's container to receive callbacks on the progress of the download. szURL:
  Pointer to a string value containing the URL to be downloaded. Cannot be set to NULL. szFileName:
  Pointer to a string value containing the name of the file to create for bits that come from the download. dwReserved:
  Reserved. Must be set to 0.lpfnCB:
  Pointer to the caller's IBindStatusCallback interface. 其中第一个参数pCaller到底该怎么写?
请高手不吝赐教!如果谁能解决另外100分也归他:
http://expert.csdn.net/Expert/topic/3044/3044742.xml?temp=.9874231

解决方案 »

  1.   

    这个贴才20分
    UrlMon.UrlDownLoadToFile(p1:ActiveX的Unknown接口;p2:pchar 文件的URL; 
    p3:pchar 保存路径及文件名;p4:dword 必须 为0;p5:IBindStatusCallback   )
      

  2.   

    怎么样才可以获得ActiveX的Unknown接口,具体该怎么写,请赐教!
      

  3.   

    不知道, 帮你顶.
    null行吗? IUnknown行吗? 我瞎说, 别理我...
      

  4.   

    VCL在TComponent就提供了一个GetComObject的方法。在适当的地方用它,可以在ACTIVEX内取到这个IUnknown接口
      

  5.   

    procedure TForm1.Button1Click(Sender: TObject);
    var p1: IUnknown;
        p2,p3: PAnsiChar;
        p4: DWORD;
        p5: IBindStatusCallback;
    begin
      p1 : = nil;
      p2 : = PCHAR('http://domain/directory/targetfile'); 
      p3 : = PCHAR('test.bmp');
       p4 : = 0; 
      p5 : = nil; 
      URLDownLoadToFile(p1,p2,p3,p4,p5);
    end;
      

  6.   

    怎么名字像 aiirii(ari-爱的眼睛) 的马夹啊!!