COM: Returning IDispatch or NULL
Mark Hammond
mhammond at skippinet.com.au
Mon Sep 23 20:12:41 EDT 2002
Juan Carlos CORUÑA wrote:
> Hello,
>
> I'm trying to develop a COM Server in python, that has a method that
> returns an IDispatch object but sometimes it must return nothing. See
> the following example programmed in C/SIDE (Microsoft Navision
> Financials ERP):
>
> --->
> otherCOMServer := COMServer.returnOtherCOMServer();
> IF ISCLEAR(otherCOMServer) THEN MESSAGE('otherCOMServer is clear');
> <----
>
> Definition of ISCLEAR (extracted from MS Navision help):
> The return value is TRUE if:
> -the automation variable has not been created. See CREATE.
> -the automation variable has been cleared. See CLEAR.
> -the automation variable has been assigned NULL by an automation
> server.
>
> I thing that in this case I must assign NULL to the otherCOMServer
> variable in order to keep the otherCOMServer variable CLEARED.
> What must I return from "COMServer.returnOtherCOMServer()" method to
> assign NULL?
> I have tried:
> return None
> return wrap(None)
> return 1==0
> return
>
> but without success. The environment responds "data type not
> supported".
None is the way to do this. What responds "data type not supported"?
Have you registered your object for debugging and seen the output?
There may be a traceback printed.
Mark.
More information about the Python-list
mailing list