首页 > 编程 > ASP > 正文

asp代码封装成dll图形化教程

2024-05-04 11:06:03
字体:
来源:转载
供稿:网友
1 :打开您的Microsoft Visual Basic--->

click for full size

点击确定,以下就按照蓝色的数字步骤.

2 :修改工程名和类模块的名称--->

click for full size

点3,把4改成bi,再点5:


click for full size

6处改成cjjer.

3 :增加到引用asp--->

click for full size

点击引用,然后选择其中的Microsoft Active Server Pages Object Library.
click for full size

点9确定.

 4%20:编写代码--->%20Option%20ExplicitPrivate%20Context%20As%20ScriptingContextPrivate%20Application%20As%20ApplicationPrivate%20Response%20As%20ResponsePrivate%20Request%20As%20RequestPrivate%20Session%20As%20SessionPrivate%20Server%20As%20ServerPublic%20Sub%20OnStartPage(PassedscriptContext%20As%20ScriptingContext)Set%20Context%20=%20PassedscriptContextSet%20Application%20=%20Context.ApplicationSet%20Request%20=%20Context.RequestSet%20Response%20=%20Context.ResponseSet%20Server%20=%20Context.ServerSet%20Session%20=%20Context.SessionEnd%20SubPublic%20Sub%20showsuc()Response.Write%20"我是蓝色理想的老农,您好"End%20Sub'%20释放内部对象Public%20Sub%20OnEndPage()Set%20Application%20=%20NothingSet%20Request%20=%20NothingSet%20Response%20=%20NothingSet%20Server%20=%20NothingSet%20Session%20=%20NothingSet%20Context%20=%20NothingEnd%20Subclick for full size

其中,除10处,其他都是必须的.
10处是我们自己要表现的程序.


ctrl+s保存在d:/mylib/cjjer.cls

在把工程保存为d:/mylib/bi.vbp

5 :编译,注册成dll--->

click for full size


点击生成bi.dll

没啥警告的话那就ok了,路径保存在d:/mylib/bi.dll.

然后开始--------->运行-->
regsvr32 d:/mylib/bi.dll


click for full size

click for full size


这就注册成功了.

6 :使用bi.dll--->

新建asp文件,输入:
<%Dim bicjjerSet bicjjer=Server.CreateObject("bi.cjjer")bicjjer.showsuc()%>

click for full size

浏览器,预览,显示如下:


click for full size


注意:对已经存在的组建名称或这修改了dll文件,必须先停止IIS,再重启注册使用,否则会一直在原来的基础上.

---------------------------------------------
修正:

经过测试,其他机器上编译的dll在另外的机器上先不注册的话无法使用,可能VB在编译成dll的时候已经在注册表里做了手脚--,已经注册了,so我怎么写路径都是虚套子,

asp外部调用dll必须到注册表注册,再次指出.


我对我以上的误导表示强烈的道歉,对所有兴奋过的id表示慰问.
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表