sulfurious Posted October 7, 2006 Posted October 7, 2006 I have an object, TypeLibInfo. Object is created. You then reference a property, which is a filename. The code looks like this expandcollapse popupDim $arGUID[1][2] $arGUID[0][0] = 0 $arGUID[0][1] = 0 $sFileName = "some dll exe ocx tlb file" $oTypeLib = ObjCreate("TLI.TypeLibInfo") If IsObj($oTypeLib) Then $oTypeLib.ContainingFile = $sFileName If @error Then MsgBox(0,"error","com") Return EndIf _ArrayAdd2($arGUID,$oTypeLib.Name,$oTypeLib.GUID) For $i = 1 To $oTypeLib.TypeInfoCount $oTypeInfo = $oTypeLib.TypeInfos($i) If $oTypeInfo.TypeKind = 5 Then ;MsgBox(0,"CLSID",$oTypeInfo.Name & @CRLF & @CRLF & $oTypeInfo.GUID) _ArrayAdd2($arGUID,$oTypeInfo.Name,$oTypeInfo.GUID) EndIf Next _ArrayDisplay2($arGUID,"arguid") EndIfoÝ÷ Øw«yªÞ¶®¶²~éíìjëh×6Func _ArrayAdd2(ByRef $avArray, $sValue1 = "", $sValue2 = "") If IsArray($avArray) Then ReDim $avArray[UBound($avArray) + 1][2] $avArray[UBound($avArray) - 1][0] = $sValue1 $avArray[UBound($avArray) - 1][1] = $sValue2 SetError(0) Return 1 Else SetError(1) Return 0 EndIf EndFunc ;--->>> _ArrayAdd2 Func _ArrayDisplay2(Const ByRef $avArray, $sTitle) Local $iCounter = 0, $sMsg = "" If (Not IsArray($avArray)) Then SetError(1) Return 0 EndIf For $iCounter = 0 To UBound($avArray) - 1 $sMsg = $sMsg & "[" & $iCounter & "] = " & StringStripCR($avArray[$iCounter][0]) & " " _ & StringStripCR($avArray[$iCounter][1]) & @CR Next MsgBox(4096, $sTitle, $sMsg) SetError(0) Return 1 EndFunc ;--->>> _ArrayDisplay2 If the file to be inspected is not registerable, then the GUID & Name properties will not exist. Duh. Anyway, put a non-registerable file in, and it throws a com error. I thought that checking for @error would catch it. I either don't understand it implicitly or ... well, maybe I just don't understand it. After I decrypted the help file on this library, and then reverse engineered it using a 128-bit offset alien to english text converter, I found thistliErrCantLoadLibrary (vbObjectError + &H202) The specified file could not be found, or the file doesn't contain a valid typelib. Raised by the TypeLibInfo.ContainingFile property. But, I am unsure exactly how to look for this error. Can anyone explain what I am missing? late, Sul
sulfurious Posted October 7, 2006 Author Posted October 7, 2006 Heh. Seems you have to declare an ObjEvent first. Then you handle the object returned error setting @error. AutoIt works pretty good if you actually put the proper code where it is needed. Sul
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now