C#调用ActiveX控件的方法
C#调用ActiveX控件时通常要进行两步操作:
第一步:注册控件,例如ABE.DLL,将ABE.DLL拷贝至系统文件夹SYSTEM32下,然后在开始中执行CMD命令,regsvr32 ABE.DLL,会提示注册成功;
第二步:打开VS2005,在项目文件中添加引用,点击浏览标签,找到放置ABE.DLL文件的位置,添加引用。
进行完上两步操作后,我们就可以在项目文件中调用ABE.DLL这个控件了,在需要调用的页面使用using ABE;,这样就可以使用ABE.DLL中的各项函数或方法了。
1
using System;
2
using System.Data;
3
using System.Configuration;
4
using System.Collections;
5
using System.Web;
6
using System.Web.Security;
7
using System.Web.UI;
8
using System.Web.UI.WebControls;
9
using System.Web.UI.WebControls.WebParts;
10
using System.Web.UI.HtmlControls;
11
using ABE;
12![](/Images/OutliningIndicators/None.gif)
13
public partial class Default3 : System.Web.UI.Page
14
{
15
protected void Page_Load(object sender, EventArgs e)
16
{
17
ABE.Connection Conn = new ABE.Connection();
18
Conn.OPEN("User=******;Password=******;Server=******;MaxPages=10 CLASSMODE=CODE+NAME+PRICE");
19
ABE.AVDataSet avstr = new ABE.AVDataSet();
20
avstr.OPEN("KMG", "CTU", "2008-03-26", "0600", "MU", "", "D", Conn);
21
Page.Response.ContentType = "text/xml";
22
Response.Write(avstr.XMLDocument);
23
}
24
}
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/None.gif)
11
![](/Images/OutliningIndicators/None.gif)
12
![](/Images/OutliningIndicators/None.gif)
13
![](/Images/OutliningIndicators/None.gif)
14
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
15
![](/Images/OutliningIndicators/InBlock.gif)
16
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
17
![](/Images/OutliningIndicators/InBlock.gif)
18
![](/Images/OutliningIndicators/InBlock.gif)
19
![](/Images/OutliningIndicators/InBlock.gif)
20
![](/Images/OutliningIndicators/InBlock.gif)
21
![](/Images/OutliningIndicators/InBlock.gif)
22
![](/Images/OutliningIndicators/InBlock.gif)
23
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
24
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)