为什么我用VB做的DLL,在引用的时候,为什么总是报没有入口点? 为什么我用VB做的DLL,在引用的时候,为什么总是报没有入口点? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如何调用DLL来加快服务器的执行速度?1、并双击新建工程窗口中ActiveX DLL图标,VB将自动为项目添加一个类模块,并将该项目类型设置为ActiveX DLL。2、在属性窗口将类模块的名称属性改为clsDice。3、从工程菜单中选择工程属性,将工程名称改为MyDLL。4、从文件菜单中选择保存clsDice,将类模块保存为myDice.cls。5、添加以下代码:Option ExplicitPrivate Max, Point As IntegerPublic Property Get Result() As IntegerResult = PointEnd PropertyPublic Property Get Maxpoint() As IntegerMaxpoint = MaxEnd PropertyPublic Property Let Maxpoint(num As Integer)Max = numEnd PropertyPublic Sub Throw()RandomizePoint = Int(Rnd * Max) + 1End SubPrivate Sub Class_Initialize()Max = 6End Sub这个类模块定义了clsDice对象的两个属性和一个方法,这些属性和方法模拟了掷色子的过程。其中Maxpoint属性表示色子的面数,加入Property Let语句可让用户修改色子的面数;Result属性表示最后掷出色子的点数;Throw方法代表掷色子的动作;Private Sub Class_Initialize语句将色子的面数缺省的设置为6面。 最后,从文件菜单中选择生成mydll.dll,并保存。下面,我们来引用类clsDice:dice.asp' 使用CreateObject函数创建clsDice对象实例(前面创建的ActiveX.DLL--MYDLL.DLL文件)<!--METADATA TYPE="typelib" FILE="Path/mydll.dll" --> ' Path是mydll.dll在机器上存放的路径 <html><head><title>精彩春风之调用DLL文件</title></head><body><%On Error Resume Next '"赦免"程序错误If Request.Form("T1")="" thenSession("point") = 6Else Session("point")=Request.Form("T1")End If' 用Session("point")来存放色子面数Set dice1=Server.Createobject("MyDLL.clsDice")' 使用set语句创建dice1对象,其中MyDLL是上面创建dll文件时的工程名,clsDice为类模块的名称If Request.ServerVariables("Request_Method")="POST" thendice1.Maxpoint = Session("point") ' 设定色子的面数 dice1.Throw ' 掷色子%><form method="POST" action="dice.asp"><p>当色子的面数为<input type="text" name="T1" size="5" value=<% = session("point") %>>时</p><p><input type="submit" value="掷色子" name="B1"></p></form><p>结果:<% = dice1.Result %>点 </p> ' 返回结果<%Else dice1.Maxpoint = Session("point") %><form method="POST" action="dice.asp"><p>当色子的面数为<input type="text" name="T1" size="5" value=<% = session("point") %>>时</p><p><input type="submit" value="掷色子" name="B1"></p></form><%End If%></body> vb6.0 的反编译工具 saveseting 这个东东 网页高手进! 根据论坛风格更换看csdn对各类语言的态度 theform是什么意思 一个ACCESS转换为文本文件的问题,请帮帮忙 关于excel中在指定列插入一行,VB代码中如何写啊??? 高高手来赐教啊~ vb怎样怎样kill一个其它程序进程?像任务管理器结束任务结束一个进程一样那样! 在VB中实现语音聊天功能? vb数据库相对路径的设置 怎样用用vb创建进程?
2、在属性窗口将类模块的名称属性改为clsDice。
3、从工程菜单中选择工程属性,将工程名称改为MyDLL。
4、从文件菜单中选择保存clsDice,将类模块保存为myDice.cls。
5、添加以下代码:
Option ExplicitPrivate Max, Point As IntegerPublic Property Get Result() As Integer
Result = Point
End PropertyPublic Property Get Maxpoint() As Integer
Maxpoint = Max
End PropertyPublic Property Let Maxpoint(num As Integer)
Max = num
End PropertyPublic Sub Throw()
Randomize
Point = Int(Rnd * Max) + 1
End SubPrivate Sub Class_Initialize()
Max = 6
End Sub
这个类模块定义了clsDice对象的两个属性和一个方法,这些属性和方法模拟了掷色子的过程。其中Maxpoint属性表示色子的面数,加入Property Let语句可让用户修改色子的面数;Result属性表示最后掷出色子的点数;Throw方法代表掷色子的动作;Private Sub Class_Initialize语句将色子的面数缺省的设置为6面。
最后,从文件菜单中选择生成mydll.dll,并保存。下面,我们来引用类clsDice:
dice.asp
' 使用CreateObject函数创建clsDice对象实例(前面创建的ActiveX.DLL--MYDLL.DLL文件)
<!--METADATA TYPE="typelib" FILE="Path/mydll.dll" -->
' Path是mydll.dll在机器上存放的路径
<html>
<head>
<title>精彩春风之调用DLL文件</title>
</head>
<body>
<%
On Error Resume Next
'"赦免"程序错误If Request.Form("T1")="" then
Session("point") = 6
Else
Session("point")=Request.Form("T1")
End If
' 用Session("point")来存放色子面数Set dice1=Server.Createobject("MyDLL.clsDice")
' 使用set语句创建dice1对象,其中MyDLL是上面创建dll文件时的工程名,clsDice为类模块的名称If Request.ServerVariables("Request_Method")="POST" then
dice1.Maxpoint = Session("point")
' 设定色子的面数
dice1.Throw
' 掷色子
%>
<form method="POST" action="dice.asp">
<p>当色子的面数为<input type="text" name="T1" size="5" value=<% = session("point") %>>时</p>
<p><input type="submit" value="掷色子" name="B1"></p>
</form>
<p>结果:<% = dice1.Result %>点 </p>
' 返回结果
<%
Else
dice1.Maxpoint = Session("point")
%>
<form method="POST" action="dice.asp">
<p>当色子的面数为<input type="text" name="T1" size="5" value=<% = session("point") %>>时</p>
<p><input type="submit" value="掷色子" name="B1"></p>
</form>
<%
End If
%>
</body>