PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Thomas Bock on July 20, 2022, 10:42:32 AM

Title: ERR option ignored
Post by: Thomas Bock on July 20, 2022, 10:42:32 AM
For a few weeks we encounter a strange error 65 every now and then, when our programs create a COM object.
Code: [Select]
ON_CREATE:
def object outlook, "[LCL]Outlook.Application", err = *next
if not(tcb(2)) then nameSpace = outlook'getNameSpace("MAPI")
return
This has been a save way ever since. On the WindX side MSG(-1) returns "Exception occured (err/ret=2/0)"
According to Eric we should check for the object reference > 0. But I wonder why the err option is ignored in these cases.
Title: Re: ERR option ignored
Post by: Mike King on July 21, 2022, 08:35:14 AM
Thomas

Can you confirm the error is on the DEF OBJECT or the call to getNameSpace?
Title: Re: ERR option ignored
Post by: Thomas Bock on July 25, 2022, 01:21:13 AM
Mike

The error is thrown by the NEW() function. The constructor as already been left, so I cannot check anything inside the object any more.
Title: Re: ERR option ignored
Post by: Mike King on July 25, 2022, 09:24:46 AM
I am not certain I follow what is happening. 

If you have an error on the DEF OBJECT you probably should force an error exit on the ON_CREATE otherwise your object will be instantiated without a valid Outlook object.

As for why the object creation fails, we have seen instances where Outlook itself is busy doing something (asking a user a question such as "Delete email?". updating mail from host, sending mail, updating calendar, ...) it doesn't accept a new connection.