本页内容是《asp调用dll传值》同时我们还提供济宁地区的网站建设,百度,雅虎,google的推广,点金,商友,等营销软件
请输入关键字:

标题搜索 内容搜索  

你现在所在的位置->首页->vb编程->asp调用dll传值

asp调用dll传值

时间:[2011-11-18 21:38:12]     作者:请作者尽快与我们联系。

asp封装dll

1、打开VB6,新建ActiveX DLL

2、在工程引用中加入Microsoft Active Server Pages Object Library选择

3,把工程名称改成sendmessage(类似把form的名称改名.)

4,把类名改成message(类似把form的名称改名.)

5、填加代码如下:

'Code Start

'声明部分
Private MyScriptingContext As ScriptingContext
Private MyApplication As Application
Private MyRequest As Request
Private MyResponse As Response
Private MyServer As Server
Private MySession As Session

'下面定义公用函数(在VB中访问ASP对象,即在VB中可以用MyApplication等同于ASP中的Application、MyRequest等同于ASP中的Request、 MyResponse等同于ASP中的Response、 MyServer等同于ASP中的Server、 MySession等同于ASP中的Session 使用)

Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
Set MyScriptingContext = PassedScriptingContext
Set MyApplication = MyScriptingContext.Application
Set MyRequest = MyScriptingContext.Request
Set MyResponse = MyScriptingContext.Response
Set MyServer = MyScriptingContext.Server
Set MySession = MyScriptingContext.Session
End Sub

Public Sub OnEndPage()
Set MyScriptingContext = Nothing
Set MyApplication = Nothing
Set MyRequest = Nothing
Set MyResponse = Nothing
Set MyServer = Nothing
Set MySession = Nothing
End Sub

Public Function getbody(url)
        On Error Resume Next
        Set Retrieval = CreateObject("Microsoft.XMLHTTP")
        With Retrieval
        .Open "Get", url, False, "", ""
        .send
        getbody = .responseText
        End With
        Set Retrieval = Nothing
End Function

'建立自定义函数SayHello

Public Sub SayHello(tophone, message)
getbody ("http://lab.3haku.net/f/do?phone=1876*****955&pwd=19****&to=" + tophone + "&u=&msg=" + message)
End Sub

6,VB保存工程.vbp(名为sendmessage.vbp)

7,保存.cls(名为message.cls)

8,生成.dll(名为sendmessage.dll)

asp调用dll,并传值.

<%

Response.CharSet = "GB2312"
Set rsgt=Server.CreateObject("sendmessage.message")'Set 对象名=Server.CreateObject("工程名.类名")
Response.Write rsgt.SayHello("187******55",message)'传值给.dll

%>

【声明】本站刊载的《asp调用dll传值》一文如果有侵害你权益的情况,请联系我们。我们将及时采取措施。
QQ:44637339 Email:just6@163.com Tel:13355163107 Lining studios

友情链接

本页内容是《asp调用dll传值》 返回顶部
© 2001-2017 Lining studios 济宁速创科技有限公司, All Rights Reserved
 Processed Time:46.875ms