调用dll问题
dll文件 MyDLL.dll已在windows注册了。
asp程序运行成功了(掷色子程序)!
-----------------------------------------------
代码dice.asp:
<html>
<head><title>在ASP文件使用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为类模块的名称。至此我们就可以用Maxpoint,Result和Throw属性(方法)来对dice1对象进行操作。
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>
-----------------------------------
同样,我在dice.php运行如下代码:
-------------------------------------------
<?
session_start();
session_register("point");
?>
<html>
<head><title>在php文件使用DLL</title></head>
<body>
<?
//On Error Resume Next
//当程序出现意外错误时能继续执行
//$["bl"];
If ($T1=="")
{
$point=6;
}
Else
{
$point=$T1;
}
//用Session("point")来存放色子的面数
$dice1=new COM("MyDLL.clsDice");
//使用set语句创建dice1对象,其中MyDLL是上面创建dll文件时的工程名称(注意:不是文件的名称),clsDice为类模块的名称。至此我们就可以用Maxpoint,Result和Throw属性(方法)来对dice1对象进行操作。
If ($B1=="掷色子")
{
$dice1->Maxpoint = $point;
//设定色子的面数
$dice1->Throw ;
//掷色子
?>
<form method="POST" action="dice.php">
<p>当色子的面数为<input type="text" name="T1" size="5" value="<?=$point;?>" >时</p>
<p><input type="submit" value="掷色子" name="B1"></p>
</form>
<p>结果为:<?=$dice1->Result;?>点 </p>
返回结果
<?
}
Else
{
$dice1->Maxpoint =$point;
?>
<form method="POST" action="dice.php">
<p>当色子的面数为<input type="text" name="T1" size="5" value="<?=$point;?>" >时</p>
<p><input type="submit" value="掷色子" name="B1"></p>
</form>
<?
}
?>
</body>
------------------------------------------------
但是显示结果总是0
请各位帮帮忙,看看为什么!谢谢!