现在要将动态库封装到activex中,并能通过网页调用动态库的api函数。
    我用ATL 添加一个接口:
    [id(1), helpstring("method Login")] HRESULT Login([in]BSTR addr,[in]BSTR port,[in]BSTR username,[in]BSTR pass);网页中传入参数:
<HTML>
<HEAD>
<TITLE>ATL 3.0 test page for object activex</TITLE>
<link href="file:///C|/Documents and Settings/Administrator.BD23E4FE89EB4CA/My Documents/1.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY>
<OBJECT ID="activex" CLASSID="CLSID:591CEB78-937F-4707-8532-8603D5F82A14"></OBJECT>
<p>
  ipaddr
  <INPUT size="40" id="Text1" value="" NAME="Text1"></input>
  port
  <INPUT size="40" id="Text2" value="" NAME="Text2">
  </input>
</p>
<p> username 
  <INPUT size="40" id="Text3" value="" NAME="Text3"></input>
  pass
  <INPUT type="Password" size="40" id="Text4" value="" NAME="Text4">
  </input>
</p>
<INPUT type="Button" value="LOGIN" onClick="dogo(document.getElementById('Text1').value,document.getElementById('Text2').value,document.getElementById('Text3').value,document.getElementById('Text4').value);" ID="Submit1" NAME="Submit1"></input><SCRIPT language="javascript">
function dogo(tesxt1,tesxt2,tesxt3,tesxt4)
{
var activex = document.getElementById("activex");
activex.Login(tesxt1,tesxt2,tesxt3,tesxt4);
}
</SCRIPT>
</BODY>
</HTML>接口 的参数类型是BSTR,我传入的是字符串型,这样行不行呀?js能将字符串转换成BSTR型?