我activeX定义了一个函数 Function getResult(sStr:widestring): widestring;我在delphi调用的时候 是有返回值的, 而在Js里面调用 时调用成功了, 但是没有返回值, js提示 undefined 。js调用 定义一个变量 然后赋值 给 getresult, 最后alert

解决方案 »

  1.   


    <htmL>
    <head>
    <title>测试网页</title>
    <script language="javascript">
    function test(){
     var Constr = "",
     FID = "",
     version = "",
     Worker = "系统管理员",
     sPath = "F:\故事.doc;F:\歌曲\下载\联系方式.txt;",
     extend = "",
     bCon = "1";
    var obj = document.getElementById("testOcx");
     var returnValue = obj.UpLoadFile(Constr,FID,version,Worker,sPath,extend,bCon);
     alert(returnValue); }
    </script>
    </head>
    <body>
    <OBJECT id="testOcx" style="display:none;"
      classid="clsid:2166312F-0211-4E2C-AF86-E1CC1AC67F89"
          codebase="E:/Test WebFR/WebFastReport.cab#version=1,1,0,1"
          width=591
          height=337
          align=center
          hspace=0
          vspace=0
    ></OBJECT> <input type="button" onclick="test()" value="测试"/>
    </body>
    </htmL>
      

  2.   

    没用过cab调用,我只会调用ocx
      

  3.   

    cab 只是 ocx的打包压缩形式啊~
      

  4.   

    你在UpLoadFile函数加入些测试的东西,例如把返回输入的结果,在控件里ShowMessage一下,看是哪里有问题
      

  5.   

    Type Library当中这个函数是如何定义?
      

  6.   

    HRESULT _stdcall UpLoadFile([in] BSTR Connstr, [in] BSTR FID, [in] BSTR version, [in] BSTR Worker, [in] BSTR sPath, [in] BSTR extend, [out, retval] BSTR * Value );