脚本是这个:
<SCRIPT LANGUAGE="vbscript">
    Dim Clipper
    Set Clipper = CreateObject("myclipper.savedoc")
    Clipper.SaveSelection(external.menuArguments.document)
</SCRIPT>Delphi里收集内容的代码:
procedure TSavedoc.SaveSelection(const iedoc: IDispatch);
var 
  doc: IHtmlDocument2; 
  url, html: string;
begin
  doc := IHtmlDocument2(iedoc);
  url := doc.url;  //这里出错
  html := doc.body.outerhtml; //也出错 
  ........
end;这是几年前写的代码, 当时是好用的, 现在用XP+SP2,在doc这里出错了,无法获得传回来的任何数据, 请问如何解决?========还有如果脚本改成下面的直接传回html内容:
<SCRIPT LANGUAGE="vbscript">
    Dim Clipper
    Set Clipper = CreateObject("myclipper.savedoc")
    alert(external.menuArguments.document.body.outerhtml) //这个用来测试,取到的是html源码
    Clipper.SaveSelection(external.menuArguments.document)
</SCRIPT>Delphi部分改成
procedure TSavedoc.SaveSelection(const html: WideString);
begin
end;提示参数不对,还是取不到数据,问题出在哪里啊,脚本或Delphi里应该怎么写? 谢谢!!

解决方案 »

  1.   

    document是个object   怎么能作为WideString参数
      

  2.   

    上面打错了, 是
    <SCRIPT LANGUAGE="vbscript">
        Dim Clipper
        Set Clipper = CreateObject("myclipper.savedoc")
        alert(external.menuArguments.document.body.outerhtml) //测试,取到的是html源码
        Clipper.SaveSelection(external.menuArguments.document.body.outerhtml)
    </SCRIPT>Delphi部分改成
    procedure TSavedoc.SaveSelection(const html: WideString);
    begin
    end;返回类型不匹配
      

  3.   

    把html设为Variant类型,传进来后再转看看
    procedure TSavedoc.SaveSelection(const html: Variant);