asp封装为dll
作者:佚名 时间:2012-04-17
1 。打开您的Microsoft Visual Basic:
点击确定,以下就按照蓝色的数字步骤.
2 。修改工程名和类模块的名称:
点3,把4改成bi,再点5:
6处改成cjjer.
3。增加到引用asp:
点击引用,然后选择其中的Microsoft Active Server Pages Object Library.
点9确定.
4。编写代码:
其中,除10处,其他都是必须的.
10处是我们自己要表现的程序.
ctrl+s保存在d:\mylib\cjjer.cls
在把工程保存为d:\mylib\bi.vbp
5 。编译,注册成dll:
点击生成bi.dll
没啥警告的话那就ok了,路径保存在d:\mylib\bi.dll.
然后开始--------->运行-->
regsvr32 d:\mylib\bi.dll
这就注册成功了.
6。使用bi.dll:
新建asp文件,输入:
<%
Dim bicjjer
Set bicjjer=Server.CreateObject("bi.cjjer")
bicjjer.showsuc()
%>
Option Explicit
Private Context As ScriptingContext
Private Application As Application
Private Response As Response
Private Request As Request
Private Session As Session
Private Server As Server
Public Sub OnStartPage(PassedscriptContext As ScriptingContext)
Set Context = PassedscriptContext
Set Application = Context.Application
Set Request = Context.Request
Set Response = Context.Response
Set Server = Context.Server
Set Session = Context.Session
End Sub
Public Sub showsuc()
Response.Write "我是linksj.com"
End Sub
' 释放内部对象
Public Sub OnEndPage()
Set Application = Nothing
Set Request = Nothing
Set Response = Nothing
Set Server = Nothing
Set Session = Nothing
Set Context = Nothing
End Sub