返回一个对象的名称或者接口描述
ObjName ( $Objectvariable [,标志] )
$Objectvariable | 您想取得的对象的对象变量 |
标志 | [可选参数] 1 = (默认)对象名称. 2 = 对象描述字符串. 3 = 对象的 ProgID. 4 = 寻找对象在注册表中关联的文件. 5 = 对象运行调用的模块名称(WIN XP及以上,针对非inproc对象). 6 = 对象接口类(coclass)的CLSID. 7 = 对象接口的IID. |
成功: | 返回按上方标志设置获取到的字符串. |
失败: | 设置 @error 并返回 "" |
Local $oInternet = ObjCreate("InternetExplorer.Application")
$oInternet.Navigate("http://www.google.com") ; Opening a web page that contains a form
Sleep(4000) ; Give the page time to load
Local $oDoc = $oInternet.document ; Example object to test
Local $oForm = $oDoc.forms(0) ; Example object to test
MsgBox(4096, "", "Interface name of $oInternet is: " & ObjName($oInternet) & @CRLF & _
"Object name of $oInternet is: " & ObjName($oInternet, 2) & @CRLF & _
"Interface name of $oDoc is: " & ObjName($oDoc) & @CRLF & _
"Object name of $oDoc is: " & ObjName($oDoc, 2) & @CRLF & _
"Interface name of $oForm is: " & ObjName($oForm) & @CRLF & _
"Object name of $oForm is: " & ObjName($oForm, 2))