SAFEARRAY parameters
From: Ed (splendided_at_aol.com)
Date: 03/05/04
- Next message: Igor Tandetnik: "Re: A puzzling question"
- Previous message: Simon Trew: "Re: A puzzling question"
- Next in thread: Igor Tandetnik: "Re: SAFEARRAY parameters"
- Reply: Igor Tandetnik: "Re: SAFEARRAY parameters"
- Messages sorted by: [ date ] [ thread ]
Date: 5 Mar 2004 07:53:26 -0800
Hello
I'm stumped. Please forgive me this is more a COM proper than an ATL
question.
I have a Dispatch interface that exposes an interface method. (I'll
call this 'DI' as not to confuse myself). This interface method
accepts amongst other parameters a SAFEARRAY(VARIANT) * as well as an
IDispatch *.
Its usage involves another process which will invoke my COM Server an
pass an IDispatch * as well as a SAFEARRAY of Variants to my DI.
I marshal the Dispatch Pointer to a stream and make a copy of the
SAFEARRAY to a SAFEARRAY * within a data structure accessible to a
worker thread. You can see where this is heading.
My worker thread passes the Marshalled interface pointer and a pointer
to the SAFEARRAY * to another object which calls IDispatch::Invoke on
my marshalled interface. Before Invoking the method I reverse the
order of my parameters by using SafeArrayAccessData, swapping the
elements and unaccessing data.
Observation 1
=============
If I do not reverse the elements, only the first item in the array is
successfully passed to the IDispatch being invoked. Although the call
succeeds.
Observation 2
=============
If I reverse the elements for each call, the parameters will be passed
successfully for the first call and the same as in observation 1 for
the second call. This behaviour is cyclical 1 call OK, 1 call with 1
bad parameter.
The SAFEARRAY data does not change during the lifetime of the process.
Any help would be gratefully received!!
Many thanks in advance.
Regards
Ed
- Next message: Igor Tandetnik: "Re: A puzzling question"
- Previous message: Simon Trew: "Re: A puzzling question"
- Next in thread: Igor Tandetnik: "Re: SAFEARRAY parameters"
- Reply: Igor Tandetnik: "Re: SAFEARRAY parameters"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|