将下面的代码复制到vb中,工程名为myvb.vbp,生成myvb.dll文件,类名为text
''对象的声明
Dim response As response
Dim reqeust As Request
Dim application As application
Dim server As server
Dim session As session
''当组件被创建的时候会触发这个事件
Public Sub OnStartPage(mysc As ScriptingContext)
''进行对象的实例化
Set response = mysc.response
Set Request = mysc.Request
Set server = mysc.server
Set application = mysc.application
Set session = mysc.session
' ' rp.write "<br>ActiveX DLL组件已经被创建了!<br>"
End Sub
''当组件被销毁的时候触发这个事件
Public Sub OnEndPage()
'' rp.write "<br>ActiveX DLL组件已经被销毁!<br>"
''销毁对象
Set response = Nothing
Set Request = Nothing
Set server = Nothing
Set application = Nothing
Set session = Nothing
End Sub
Public Sub HelloWorld()
rp.Write "<H1>Hello,World!</H1>"
End Sub
------------------------------------------------------------------------------------------
通过下面的代码来调用
<%set testme=server.createobject("myvb.text")
testme.helloworld
set testme=nothing
%>
--------------------------------------------------------------------
用下面的代码来在"开始/运行"下进行注册.
Regsvr32.exe D:/aspdll/myvb.dll
''对象的声明
Dim response As response
Dim reqeust As Request
Dim application As application
Dim server As server
Dim session As session
''当组件被创建的时候会触发这个事件
Public Sub OnStartPage(mysc As ScriptingContext)
''进行对象的实例化
Set response = mysc.response
Set Request = mysc.Request
Set server = mysc.server
Set application = mysc.application
Set session = mysc.session
' ' rp.write "<br>ActiveX DLL组件已经被创建了!<br>"
End Sub
''当组件被销毁的时候触发这个事件
Public Sub OnEndPage()
'' rp.write "<br>ActiveX DLL组件已经被销毁!<br>"
''销毁对象
Set response = Nothing
Set Request = Nothing
Set server = Nothing
Set application = Nothing
Set session = Nothing
End Sub
Public Sub HelloWorld()
rp.Write "<H1>Hello,World!</H1>"
End Sub
------------------------------------------------------------------------------------------
通过下面的代码来调用
<%set testme=server.createobject("myvb.text")
testme.helloworld
set testme=nothing
%>
--------------------------------------------------------------------
用下面的代码来在"开始/运行"下进行注册.
Regsvr32.exe D:/aspdll/myvb.dll