Sign in to follow this  
Followers 0
KFL42

COM / OLE Object - Error Code 80020003, Member not found

14 posts in this topic

Hallo,

I'm trying to automate one of our ERP-Applications, which includes an OLE / COM Interface (late bindung).

Until now, this work was done with VBA and/or VBScript and it works fine.

Since I'm an enthusiastic fan of AutoIt, I want to do this work with AutoIt instead of VBA / VBS.

But there is a strange problem with using some of the methods of that application object in oppostion to using them with vba / vbs.

If this methods are used, I get the following COM-Object error: 80020003, Member not Found.

Im folgenden habe ich mal ein Beispiel-Skript aufgelistet:

Here is an example:

------------------------------------

Local $oHWP

Local $wert

Local $i

$oHWP = ObjCreate ("HWP.Anwendung")

if ($oHWP.Angemeldet = 0) Then ; works (checks if logged in)

$oHWP.Anmelden ("USER","PASSWORD") ; works not: "COM-Error 80020003, Member not found"

endif

$wert = $oHWP.Version ; works (get the version number)

$wert = $oHWP.Table("ADR").Anzahl ; works (get the number of address contacts)

$oHWP.Table("ADR").ErsterSatz ; works not: "COM-Error 80020003, Member not found" (go to first record)

For $i = 1 to $wert

MsgBox (0, "Information", $oHWP.Table("ADR").Feld("Nummer")) ; works

$oHWP.Table("ADR").NaechsterSatz ; works (go to next record)

Next

$oHWP = 0

Exit

------------------------------------

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.

Remember: all :mellow: methods of the application objects works fine while using VBA / VBS.

Therefor the software vendor says that his application and its COM-Interface (Type: late bindung) is in proper style and it must be an problem with AutoIt.

Now the Questions:

Are there any specifics or tricks of AutoIt for using COM-Objects?

Thanks in advance for any suggestions.

With best regards, Frank

Share this post


Link to post
Share on other sites

Sorry, I can't help a whole lot because I don't speak the language, but you might try using _IEErrorHandlerRegister() instead of using your own error handler, it's pretty solid and works even if you don't use any of the _IE functions (you just have to include <IE.au3>). Maybe it'll give you a little bit better info on the error?

Share this post


Link to post
Share on other sites

@exodius,

thanks for your suggestion, but I still get the same error informations through _IEErrorHandlerRegister() cause this method offers only the same informations as the standard error handler.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Your other topic was removed. Do not the same question/topic in multiple forums here.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Can you post the VB counter-part and the documentation for the COM interface?

Share this post


Link to post
Share on other sites

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

P.S.: Thanks to all others for help.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Does anyone know what this app is called or where I can get a demo version of it so that I can troubleshoot?

I think it is the HWP Basic or one of the other software products on this site. Since this software is modular, basic should be enough for testing I think. Sorry, I cannot find an english description. Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Is there a demo link or anything?

I don't think so.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

http://www.autoitscript.com/trac/autoit/ticket/1963#comment:2

I created this on the bug tracker regarding the bug mentioned in this post (it had been marked as fixed but I was still seeing the behavior).

It was closed out as a duplicate, but I think it should still be open.

I just added a comment to it, but I wasn't sure whether adding a comment to a closed bug would bring it to anybody's attention so I thought I'd post here.

If I should create a new ticket just let me know.

Thanks!

Share this post


Link to post
Share on other sites

The fact that you do not know what to do is a reflection on how well you pay attention. When you create a new ticket you're greeted with a giant red box that explicitly says:

Do not create a new ticket because an old ticket was closed. Reply to the old ticket if you have additional information and the developers will make the determination if the ticket should be re-opened.

The guidelines have been there for a couple years now. Ignoring them and creating a new duplicate ticket results in it being closed. Then you splinter the comments on the subject which further confuses the issue.

Anyway, I've re-opened the original ticket for now until I can investigate one way or the other.

Share this post


Link to post
Share on other sites

You're right, totally my error. Sorry about that.

I moved the information over into the original ticket.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0