运行ActiveX DLL 工程后 在asp中 set 变量名=server.createobject("ActiveX DLL 工程名")
还是有问题: 我直接将工程生成dll可以运行,但是按您说的方法调试,却行不通?为什么阿? asp执行错误,提示如下: 错误类型: 服务器对象, ASP 0177 (0x800401F3) 无效的 ProgID。 若要获取关于此消息的更多的信息,请访问 Microsoft 联机支持站点: http://www.microsoft.com/contentredirect.asp 。 /a.asp, 第 5 行 ----------------- asp代码如下: <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <%dim ax set ax=server.createobject("aspdll.sendmsg") dim b response.write(ax.hello("你好")) set a=nothing'http://127.0.0.1/a.asp?str=5654 %> --------------------------- vb中工程叫aspdll 类名叫 sendmsg vb代码如下:Private MyScriptingcontext As ScriptingContext Private MyApplication As Application Private MyRequest As Request Private MyResponse As Response Private MyServer As Server Private MySession As SessionPublic 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 SubPublic Sub onendpage() Set MyScriptingcontext = Nothing Set MyApplication = Nothing Set MyRequest = Nothing Set MyResponse = Nothing Set MyServer = Nothing Set MySession = Nothing End Sub'以上语句是必须的。 '定义两个公有函数Public Function hello(strA As String) As String MyResponse.Write ("<font color=red>i got</font>:" & strA) hello = MyRequest("helloword")
我创建了一个新的工程,然后写: Private Sub Command1_Click() On Error GoTo dd Dim ax Set ax = CreateObject("aspdll.sendmsg") '这行出错 Dim b response.write (ax.sendmsg.hello("你好")) Set a = Nothing dd: Debug.Print Err.Number & Err.Description End Sub提示为: -2147024770自动化错误------- 我真弄不懂了,生成dll以后就能执行了,但是无法调试。没生成前怎么这么多麻烦?
在asp中
set 变量名=server.createobject("ActiveX DLL 工程名")
我直接将工程生成dll可以运行,但是按您说的方法调试,却行不通?为什么阿?
asp执行错误,提示如下:
错误类型:
服务器对象, ASP 0177 (0x800401F3)
无效的 ProgID。 若要获取关于此消息的更多的信息,请访问 Microsoft 联机支持站点: http://www.microsoft.com/contentredirect.asp 。
/a.asp, 第 5 行
-----------------
asp代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%dim ax
set ax=server.createobject("aspdll.sendmsg")
dim b
response.write(ax.hello("你好"))
set a=nothing'http://127.0.0.1/a.asp?str=5654
%>
---------------------------
vb中工程叫aspdll 类名叫 sendmsg
vb代码如下:Private MyScriptingcontext As ScriptingContext
Private MyApplication As Application
Private MyRequest As Request
Private MyResponse As Response
Private MyServer As Server
Private MySession As SessionPublic 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 SubPublic Sub onendpage()
Set MyScriptingcontext = Nothing
Set MyApplication = Nothing
Set MyRequest = Nothing
Set MyResponse = Nothing
Set MyServer = Nothing
Set MySession = Nothing
End Sub'以上语句是必须的。
'定义两个公有函数Public Function hello(strA As String) As String
MyResponse.Write ("<font color=red>i got</font>:" & strA)
hello = MyRequest("helloword")
End Function
然后运行你的ASP文件。
这种方法是应该行得能的。你所说的错误说明工程 没有运行或工程运行时不能自动注册ProgID。
服务器对象, ASP 0178 (0x80070005)
检查权限时Server.CreateObject 的调用失败。对此对象的访问被拒。
/a.asp, 第 5 行
------
说没有权限?请问,调试还要设定权限吗?我已经在iis里面设定了服务器和客户端调试全开了阿?to GladisionBoy() :工程属性已经设定城等待创建了。 工程肯定已经运行了
to bruce_figo(管理员) :该属性已经设定成 5-multiuse了
,调用Hello或者别的函数,看看能否正常引用该Activex Dll工程并创建sendmsg对象
Private Sub Command1_Click()
On Error GoTo dd
Dim ax
Set ax = CreateObject("aspdll.sendmsg") '这行出错
Dim b
response.write (ax.sendmsg.hello("你好"))
Set a = Nothing
dd:
Debug.Print Err.Number & Err.Description
End Sub提示为:
-2147024770自动化错误-------
我真弄不懂了,生成dll以后就能执行了,但是无法调试。没生成前怎么这么多麻烦?
工程中的菜单栏里"工程-->引用"是可以看到该Activex Dll工程名的,如果看不到,那
就说明你的Activex Dll工程,运行以后没有被注册,这种问题就说不明白了,也有可能
是系统问题。试试重新启动电脑把以前编译后注册的Activex Dll全部反注册,然后再试
一遍,不行的话俺也不懂了,请高手吧
工程编译后注册的啊