现在要将动态库封装到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型?
我用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型?
解决方案 »
- 关于构造函数的问题
- vector问题??
- 111222 你的恐怖网站 ifree.533.net 上不去,请发一份给我好吗?
- 菜问题:多线程中怎么定义一个全局变量?怎么在启动其它线程时使用另外一个类中的函数?
- 123.45不用转换为字符串的函数,怎么将5个数字分别取出来(能够将小数点前后的分别转成整数也行)。谢谢
- 多个结构体下,S端如何判断接受的是哪一个结构体?
- 请问怎样调用zip32.dll进行软盘分卷压缩
- How to add a Dialog before the main window start?
- 为什么这样就不行?(我也不知道这算什么问题)
- MFC绘图求指教啊
- 关于控件Custom Control的使用
- 工具条按钮2个同时处于选中状态
Internet Explorer 遇到问题需要关闭,我们对此一起的不便表示抱歉
这是为什么呀?