3月9

服务器讯息CheckObjInstalled函数

| |
13:44 ASP  From: 本站原创
服务器讯息CheckObjInstalled函数
缺少关键组件的Server,将会使asp运作大受影响,但要如何知道Server支持那些组件呢??
可以使用底下CheckObjInstalled这个函数,它提供很大的便利性

  程序代码


<%

Function  CheckObjInstalled(strClassString)

        On  Error  Resume  Next

        Dim  Temp

        Err  =  0

        Dim  TmpObj

        Set  TmpObj  =  Server.CreateObject(strClassString)

        Temp  =  Err

        IF  Temp  =  0  or  Temp  =  -2147221477  Then

                CheckObjInstalled=  "<font  color=""#FF0000""><b>√</b></font>"

        ElseIF  Temp  =  1  or  Temp  =  -2147221005  Then

                CheckObjInstalled="<font  color=""#FF0000""><b>×</b></font>"

        End  IF

        Err.Clear

        Set  TmpObj  =  Nothing

        Err  =  0

End  Function

str=CheckObjInstalled("JMail.Message")

response.write "支援Jmail否??"&str&"<br>"

str=CheckObjInstalled("Persits.MailSender")

response.write "支援AspMail否??"&str&"<br>"

str=CheckObjInstalled("CDONTS.NewMail")

response.write "支援cdonts否??"&str&"<br>"

str=CheckObjInstalled("Persits.Upload")

response.write "支援AspUpload否??"&str&"<br>"

str=CheckObjInstalled("Scripting.FileSystemObject")

response.write "支援Scripting.FileSystemObject否??"&str&"<br>"

str=CheckObjInstalled("MSXML2.ServerXMLHTTP")

response.write "支援MSXML2.ServerXMLHTTP否??"&str&"<br>"

str=CheckObjInstalled("Microsoft.XMLDOM")

response.write "支援Microsoft.XMLDOM否??"&str&"<br>"

str=CheckObjInstalled("ADODB.Stream")

response.write "支援ADODB.Stream否??"&str&"<br>"

str=CheckObjInstalled("Scripting.Dictionary")

response.write "支援Scripting.Dictionary否??"&str&"<br>"

%>


最后编辑: tommyhu 编辑于2009/03/09 14:22
阅读(4543) | 评论(0) | 引用(0)
在此留下酱油瓶-:)
表情
emotemotemotemotemotemotemotemotemotemotemotemotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我

您的大名(例如:小明) : 

密码(可不填) :  游客无需密码

网址 (可不填) : 

电邮 (可不填) :  [注册]