At 10.31 15/10/2008 -0700, you wrote:
[EMAIL PROTECTED] wrote:
> Hi all,
> I still have some problems with my server.
>
> I have a function that should return three parameters defined as:
>
>  HRESULT GetInfo([out] BSTR *name, [out] BSTR *version, [out] BSTR
> *description);
>
> If I return a tuple with three string I get an error saying that the
number
> of returned parameters is wrong (3 in place of 4). I read this post
> http://markmail.org/message/rjpdosrliyne65fd
> and added a fourth parameter as first one with a 0 value (OK). 
> I'm not sure this is a right solution and I'd like to ask if something has
> changed from that post. 
>   

>I would think this is fairly clear.  Your function returns four things:
an HRESULT and three strings.  That's what your tuple needs to contain.

I was not sure since in the post I read:
"After adding an HRESULT as the first element of the returned tuple, I found
that the *last* element of the returned tuple was being used as the
function's return value instead of the *first* value (or second after the
HRESULT?) as expected."
I cannot test the actual values I get, but I need to solve the second
problem (below).


> Unfortunately I cannot test if the values returned are good since after
that
> call I get another call to another function that raise an exception.
> The other function is defined as
>
>  HRESULT func2([out] IEnumString ** param1);
>
> I can creat an object that implement IEnumString and return it but after
> that I get a QueryInterface on it with iid set to IID_NULL (a list of 0s).
>   

>Again, this function returns two things: an HRESULT and an interface. 
Are you returning a two-tuple?

Looking at the code in universal.py (at the end of the file) I understand
that HRESULT is mandatory only if you are returning a tuple of results,
otherwise if you are returning a single result there's no problem. I tried
both methods and it seems ok. 
The problem is that after having returned the object I get a call (on the
object) to QueryInterface with IID_NULL. I received the piece of code that
calls this but there's nothing strange:

        CComPtr<IEnumString> e;
        result = t->func2(&e);

and

        BSTR ret_str = NULL;
            er = e->Next(1, &ret_str, &fetched);

For the Python object I tried both with a class that expose IEnumString
interface and with util.ListEnumerator passing pythoncom.IID_IEnumString. I
get the same result, the object is correct, the QueryInterface with
IID_IEnumString is served and after that the last QueryInterface that I
don't know where it comes from.
During the weekend I will try to build a small client in C++ and verify it.

Thanks anyway,
Enrico





_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to