Chinaunix首页 | 论坛 | 博客
  • 博客访问: 16490159
  • 博文数量: 5645
  • 博客积分: 9880
  • 博客等级: 中将
  • 技术积分: 68081
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-28 13:35
文章分类

全部博文(5645)

文章存档

2008年(5645)

我的朋友

分类:

2008-04-28 20:32:05

下载本文示例代码
  首先写ActiveX Dll:   新建一个VB6工程,ActiveX Dll将工程命名为P_test,类名为c_test ,类的文件内容如下: Option ExplicitPrivate MyScriptingContext As ScriptingContext Private MyApplication As ApplicationPrivate MyRequest As Request Private MyResponse As ResponsePrivate MyServer As Server Private MySession As 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 = NothingSet MyApplication = NothingSet MyRequest = Nothing Set MyResponse = Nothing Set MyServer = Nothing Set MySession = Nothing End Sub Public Function Test_Number(num) As Variant If num < 0 Then Get_Number_Attrib = -1 If num > 0 Then Get_Number_Attrib = 1 If num = 0 Then Get_Number_Attrib = 0 End Function   编译生成p_test.dll文件   注册   提示符下运行:regsvr32 p_test.dll   编写php文件,test.php4代码如下: <? $b=new COM("p_test.c_test"); $a=$b->Test_Number(-454); echo $a; ?>   可能遇到的问题是,编译工程时通不过,要将 Microsoft Active Server Pages Object Library   引用进来,具体实现"Project->References"找到改库,并勾上 。   首先写ActiveX Dll:   新建一个VB6工程,ActiveX Dll将工程命名为P_test,类名为c_test ,类的文件内容如下: Option ExplicitPrivate MyScriptingContext As ScriptingContext Private MyApplication As ApplicationPrivate MyRequest As Request Private MyResponse As ResponsePrivate MyServer As Server Private MySession As 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 = NothingSet MyApplication = NothingSet MyRequest = Nothing Set MyResponse = Nothing Set MyServer = Nothing Set MySession = Nothing End Sub Public Function Test_Number(num) As Variant If num < 0 Then Get_Number_Attrib = -1 If num > 0 Then Get_Number_Attrib = 1 If num = 0 Then Get_Number_Attrib = 0 End Function   编译生成p_test.dll文件   注册   提示符下运行:regsvr32 p_test.dll   编写php文件,test.php4代码如下: <? $b=new COM("p_test.c_test"); $a=$b->Test_Number(-454); echo $a; ?>   可能遇到的问题是,编译工程时通不过,要将 Microsoft Active Server Pages Object Library   引用进来,具体实现"Project->References"找到改库,并勾上 。 下载本文示例代码


如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?如何用PHP调用自己编写的COM组件?
阅读(152) | 评论(0) | 转发(0) |
0

上一篇:PHP中的XML应用

下一篇:PHP中的Java扩展

给主人留下些什么吧!~~