Opened on Jun 2, 2010 at 7:46:33 AM
Closed on Dec 9, 2011 at 7:21:28 PM
Last modified on Feb 9, 2012 at 3:00:42 PM
#1658 closed Bug (Fixed)
COM / OLE object access causes error code 80020003 - member not found
| Reported by: | Owned by: | Jon | |
|---|---|---|---|
| Milestone: | 3.3.7.22 | Component: | AutoIt |
| Version: | Other | Severity: | None |
| Keywords: | COM / OLE Object - Error Code 80020003, Member not found | Cc: |
Description
Hallo,
while writing some AutoIt scripts to automate one of our ERP-Applications, which includes an OLE / COM Interface with late bindung, I get some exceptional errors.
For some methods of the COM-Objects, the following error was reported: COM-Object error 80020003, Member not Found.
The same methods or rather the whole COM Interface works fine when using it with other programming languages like VBA, VBScript, C# VC++ etc. in the same environment (OS etc.) and the same manner (syntax etc.).
Therefor the software vendor says that his application (written in Delphi) and its COM-Interface (Type: late bindung) is in proper style and it must be an problem with AutoIt.
Here is an example:
Local $oHWP
Local $wert
Local $i
$oHWP = ObjCreate ("HWP.Anwendung")
if ($oHWP.Angemeldet = 0) Then ; check if logged in -> works
$oHWP.Anmelden ("USER","PASSWORD") ; login with credentials ->
; cause COM-Error 80020003 -
; Member not found
endif
$wert = $oHWP.Version ; get version number -> works
$wert = $oHWP.Table("ADR").Anzahl ; number of contacts -> works
$oHWP.Table("ADR").ErsterSatz ; go to first record ->
; cause COM-Error 80020003 -
; Member not found"
For $i = 1 to $wert
; do something with current record,
$oHWP.Table("ADR").NaechsterSatz ; go to next record -> works
Next
$oHWP = 0
Exit
It's very strange that the statement "$oHWP.Table("ADR").NaechsterSatz" works fine while the statement "$oHWP.Table("ADR").ErsterSatz" causes an error although both works fine while using them in many other programming languages.
Also an simple call of the method "$oHWP.Anmelden ("...")" causes an error 80020003 while it doesn't in VBA etc.
Is there a bug in AutoIt?
P.S.:
- All error codes are determined by standard error handling of AutoIt ($oMyError = ObjEvent("AutoIt.Error","MyErrFunc") etc.), which was omit for the reason of clarity of code.
- Using of COM methods (syntax etc.) in the example above is in accordance of the programming guidelines of the software vendor
With best regards, Frank
Attachments (0)
Change History (17)
follow-up: 2 comment:1 by , on Jun 2, 2010 at 3:55:05 PM
comment:2 by , on Jun 2, 2010 at 4:25:32 PM
Replying to Jpm:
Frank,
It will be more than difficult to analyze what's wrong in AutoIt without the file(s) allowing to create the object "HWP.Anwendung" and execute it.
Hallo,
after some additional tests i found out, that only methods which are implemented as "procedures" (without a return value) are affected
Methods which are implemented as "functions" (with a return value) and properties works fine.
Possibly, AutoIt has a problem with those kind of methods (without a return value), since the COM-Interface works well with all other tested languages (VBA, VBS, VC, C#, Delphi).
Is there a workaround, e.g. a stub procedure which is calling object methods with a DllCall where the object variable is passed per DllStruct or something else?
P.S.: i can provide a fully functional demo version of that ERP Application on my FTP-server for you to download
follow-up: 4 comment:3 by , on Jun 3, 2010 at 8:10:54 AM
| Owner: | set to |
|---|---|
| Status: | new → assigned |
Thanks,
In fact I hope Jon or Valik can enter this testing as I don't know enough about COM AutoIt implementation. They certainly request you more but perhaps your last post will help them without the FTP. ;)
comment:4 by , on Jun 3, 2010 at 6:25:15 PM
Replying to Jpm:
Thanks,
In fact I hope Jon or Valik can enter this testing as I don't know enough about COM AutoIt implementation. They certainly request you more but perhaps your last post will help them without the FTP. ;)
Thanks to DaX an ProgAndy from the german AutoIt Community, I've got the following workaround and it works fine.
It based on MS ScriptControl, so all problematic methods can be executed as "embedded" VBS code.
#Region *** Declares ***
Global $oHWP
Global $oScriptHost
Global $sCode
Global $retVal
#EndRegion *** Declares ***
#Region *** Init ScriptControl ***
$oScriptHost = ObjCreate("ScriptControl")
$oScriptHost.Language = 'vbscript'
$oScriptHost.Modules.Add('HWP')
$sCode = 'Sub Anmelden(ByVal HWP, ByVal Benutzer, ByVal Kennwort)'
$sCode &= @CRLF & 'HWP.Anmelden Benutzer, Kennwort'
$sCode &= @CRLF & 'End Sub'
$sCode &= @CRLF & 'Sub ErsterSatz(ByVal HWP)'
$sCode &= @CRLF & 'HWP.Table("ADR").ErsterSatz'
$sCode &= @CRLF & 'End Sub'
$sCode &= @CRLF & 'Sub NaechsterSatz(ByVal HWP)'
$sCode &= @CRLF & 'HWP.Table("ADR").NaechsterSatz'
$sCode &= @CRLF & 'End Sub'
$oScriptHost.Modules('HWP' ).AddCode($sCode)
#EndRegion *** Init ScriptControl ***
$oHWP = ObjCreate('HWP.Anwendung')
If ($oHWP.Angemeldet = 0) Then
$oScriptHost.Modules('HWP' ).Run('Anmelden', $oHWP, 'USERNAME', 'PASSWORD')
EndIf
$retVal = $oHWP.Version
$retVal = $oHWP.Table('ADR' ).Anzahl
$oScriptHost.Modules('HWP' ).Run('ErsterSatz', $oHWP)
For $i = 1 To $retVal
MsgBox(0, 'Information', $oHWP.Table('ADR' ).Feld('Nummer'))
$oScriptHost.Modules('HWP' ).Run('NaechsterSatz', $oHWP)
Next
$oHWP = 0
$oScriptHost = 0
On the other hand, this workaround shows, that AutoIt might have a problem with calling methods of a "late binding" COM-Interface that don't return a value, cause calling those methods work fine in VBS.
@Jon, @Valik: for further information feel free to contact me
comment:6 by , on Jun 5, 2011 at 3:02:14 PM
| Milestone: | → 3.3.7.9 |
|---|---|
| Resolution: | → Fixed |
| Status: | assigned → closed |
Fixed by revision [6121] in version: 3.3.7.9
comment:7 by , on Oct 6, 2011 at 6:59:15 PM
| Resolution: | Fixed |
|---|---|
| Status: | closed → reopened |
Apparently this may not be fixed so I'm reopening it until I can test one way or the other.
comment:8 by , on Oct 6, 2011 at 8:29:48 PM
Yep, I didn't read the ticket guidelines and posted another ticket on it when I shouldn't have. Sorry about that. Here's the text from the other ticket, which includes a re-create for a scenario I know isn't working in 3.3.7.18.
The code below properly opens the report in 3.3.6.0, but causes a COM "member not found error" on the line $CR_ObjViewer.ReportSource = $CR_ObjReport (commented in the code).
#Region ; Directives created by AutoIt3Wrapper_GUI
#AutoIt3Wrapper_UseX64=n
#EndRegion ; Directives created by AutoIt3Wrapper_GUI
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Initialize a COM error handler
Func MyErrFunc()
Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _
"err.description is: " & @TAB & $oMyError.description & @CRLF & _
"err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
"err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _
"err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
"err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
"err.source is: " & @TAB & $oMyError.source & @CRLF & _
"err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
"err.helpcontext is: " & @TAB & $oMyError.helpcontext _
)
Local $err = $oMyError.number
If $err = 0 Then $err = -1
$g_eventerror = $err ; to check for after this function returns
Endfunc
$gui = guicreate("TEST", 500, 500)
$sReportName = FileOpenDialog("Select RPT Source File", ".", "RPT (*.rpt)", 3)
if $sReportName <> "" and fileexists($sReportName) then
$CR_ObjApp = ObjCreate("CrystalRuntime.Application.11")
If $CR_ObjApp = 0 Then
msgbox(0, "Error", "Crystal Reports is not installed.", default, $gui)
else
$CR_ObjReport = $CR_ObjApp.OpenReport($sReportName)
If $CR_ObjReport = 0 Then
msgbox(0, "Error", "Unable to open report.", default, $gui)
else
$CR_ObjViewer = ObjCreate("CrystalReports11.ActiveXReportViewer.1")
$CR_ObjViewer.DisplayGroupTree = true
;Creates an ActiveX control in the GUI.
$ActiveX = GUICtrlCreateObj ( $CR_ObjViewer, 10, 10, 480, 480)
$CR_ObjViewer.ReportSource = $CR_ObjReport ;this line causes a COM error "member not found" in beta 3.3.7.10, but not in earlier non-beta versions
$CR_ObjViewer.ViewReport
endif
endif
endif
Of course CR must be installed, here is a thread discussion on it: http://www.autoitscript.com/forum/topic/12813-crystal-reports-viewer-in-autoit/
comment:9 by , on Oct 6, 2011 at 8:30:52 PM
The other, duplicate ticket is here: http://www.autoitscript.com/trac/autoit/ticket/1963
comment:11 by , on Nov 9, 2011 at 8:45:10 AM
ActiveX download links are no more available. Please update if you want some testing be done
Thanks
comment:12 by , on Nov 21, 2011 at 8:13:34 PM
I am attempting to come up with something, and will post it soon.
comment:13 by , on Dec 3, 2011 at 8:15:06 PM
This should be fixed with the next beta (3.3.7.22). Please test if you know how.
I will close this ticket soon as fixed unless somebody proves it still exists.
comment:14 by , on Dec 8, 2011 at 6:36:46 PM
Yep, it is fixed. You guys are awesome, especially considering I was never able to get you the CR runtime to test with.
comment:15 by , on Dec 9, 2011 at 7:21:28 PM
| Resolution: | → Fixed |
|---|---|
| Status: | reopened → closed |
| Version: | 3.3.6.0 |
Great, closing then.
Fixed by revision [6475] in version: 3.3.7.22
comment:16 by , on Dec 9, 2011 at 9:00:01 PM
| Milestone: | → Future Release |
|---|---|
| Version: | → Other |
Automatic ticket cleanup.
comment:17 by , on Feb 9, 2012 at 3:00:42 PM
| Milestone: | Future Release → 3.3.7.22 |
|---|

Frank,
It will be more than difficult to analyze what's wrong in AutoIt without the file(s) allowing to create the object "HWP.Anwendung" and execute it.