1. EuCOM - Passing an object to another object
- Posted by Jonas Temple <jtemple at yhti.net>
Apr 03, 2006
-
Last edited Apr 04, 2006
Matt (or whoever),
I have a COM object (let's say object A) where I need to pass COM object B to
COM object A as a parameter for a DISPATCH_METHOD.
What is the parm type for this? Should I be using get_obj_from_this()?
Thanks!
Jonas Temple
http://www.yhti.net/~jktemple
2. Re: EuCOM - Passing an object to another object
Jonas Temple wrote:
>
> Matt (or whoever),
>
> I have a COM object (let's say object A) where I need to pass COM object B to
> COM object A as a parameter for a DISPATCH_METHOD.
>
> What is the parm type for this? Should I be using get_obj_from_this()?
>
>
You should probably use get_obj_this(). When you pass a EuCOM handle, it
will return the actual pointer to the object. get_obj_from_this() goes
the other way. The parameter type should be either VT_DISPATCH or
VT_UNKNOWN.
Matt Lewis
3. Re: EuCOM - Passing an object to another object
Matt Lewis wrote:
> You should probably use get_obj_this(). When you pass a EuCOM handle, it
> will return the actual pointer to the object. get_obj_from_this() goes
> the other way. The parameter type should be either VT_DISPATCH or
> VT_UNKNOWN.
Well at least I was on the right track...
I tried the get_obj_from_this() with type VT_DISPATCH and VT_UNKNOWN. On one of
the invoke() calls I get a machine exception from call_stdcall_proc().
Here's the interface definition from the include created by tbrowse:
-- disp methods for AutScreenReco
global constant
AutScreenReco_m_AddPS = 1610743808,
-- Add a PS object to monitor to the autScreenReco Object
-- Returns: VT_VOID
-- AutPS VT_DISPATCH [IN]
AutScreenReco_m_IsMatch = 1610743812,
-- Compare a given PS to a given Screen Description
-- Returns: VT_VOID
-- AutPS VT_DISPATCH [IN]
-- ScreenDescription AutScreenDesc [IN]
AutScreenReco_m_RegisterScreen = 1610743810,
-- Register the Screen Description with the Screen Recognition
-- Object
-- Returns: VT_VOID
-- ScreenDescription AutScreenDesc [IN]
AutScreenReco_m_RemovePS = 1610743809,
-- Remove a PS object from the autScreenReco Object
-- Returns: VT_VOID
-- AutPS VT_DISPATCH [IN]
AutScreenReco_m_UnregisterScreen = 1610743811
-- Unregister a Screen Description from the Screen Recognition
-- Object
-- Returns: VT_VOID
-- ScreenDescription AutScreenDesc [IN]
the error is happening on the m_RegisterScreen method. The call to m_AddPS
works file and as you can see, the AutPS object is defined the VT_DISPATCH.
However in m_RegisterScreen the "RegisterScreen" object is defined as
AutScreenDesc, not VT_DISPATCH or VT_UNKNOWN.
What's the difference between the two?
Thanks!
Jonas Temple
http://www.yhti.net/~jktemple
4. Re: EuCOM - Passing an object to another object
Jonas Temple wrote:
>
>
> Here's the interface definition from the include created by tbrowse:
>
> }}}
<eucode>
> AutScreenReco_m_RegisterScreen = 1610743810,
> -- Register the Screen Description with the Screen Recognition
> -- Object
> -- Returns: VT_VOID
> -- ScreenDescription AutScreenDesc [IN]
> </eucode>
{{{
>
> the error is happening on the m_RegisterScreen method. The call to m_AddPS
> works file and as you can see, the AutPS object is defined the VT_DISPATCH.
> However in m_RegisterScreen the "RegisterScreen" object is defined as
> AutScreenDesc,
> not VT_DISPATCH or VT_UNKNOWN.
>
> What's the difference between the two?
>
The correct type should probably be VT_UNKNOWN. This means that you have
a pointer to an IUnknown interface (which is every interface). VT_DISPATCH
could be correct. AutScreenDesc is (presumably) another type of object
defined elsewhere. It tells you what sort of thing you need to pass.
The VT_UNKNOWN is used as a catch-all for these sorts of things, since
all interfaces must inherit from IUnknown.
Matt Lewis