Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HELP: Using BEGIN_INTERFACE... implementation

16 views
Skip to first unread message

John Dudmesh

unread,
Nov 9, 1995, 3:00:00 AM11/9/95
to
I'm trying to declare a custom interface from a CCmdTarget derived
class. The BEGIN_INTERFACE_PART macro defines the IUnknown functions
but the sample code for the QueryInterface implemntation in TechNote
38 does not work -

HRESULT FAR EXPORT CSecurity::XJohnObj::QueryInterface(
REFIID iid, LPVOID FAR* ppvObj)
{
METHOD_PROLOGUE(CSecurity, JohnObj)
return pThis->ExternalQueryInterface(iid, ppvObj);
}

I get the error..
error C2664: 'ExternalQueryInterface' : cannot convert parameter 1 from 'const struct ::GUID ' to 'const void __far *'

I can't cast iid to anything useful so now I'm stuck - HELP!!!!

p.s. I'm still using v1.51 perhaps this is fixed in 1.52/4.0

Many Thanks - John Dudmesh

Kevin Jones

unread,
Nov 9, 1995, 3:00:00 AM11/9/95
to
In article: <8159393...@dudmesh.demon.co.uk> John Dudmesh <jo...@dudmesh.demon.co.uk> writes:

> I'm trying to declare a custom interface from a CCmdTarget derived
> class. The BEGIN_INTERFACE_PART macro defines the IUnknown functions
> but the sample code for the QueryInterface implemntation in TechNote
> 38 does not work -
>
> HRESULT FAR EXPORT CSecurity::XJohnObj::QueryInterface(
> REFIID iid, LPVOID FAR* ppvObj)
> {
> METHOD_PROLOGUE(CSecurity, JohnObj)
> return pThis->ExternalQueryInterface(iid, ppvObj);
> }
>
> I get the error..
> error C2664: 'ExternalQueryInterface' : cannot convert parameter 1 from 'const struct ::GUID ' to 'const void __far *'

For some reason CCmdTarget::ExternalQueryInterface() takes a void *
as the first paramter and then casts it back into a IID * internally. If you
cast the iid first all should be ok.

return pThis->ExternalQueryInterface((void*)iid,ppvObj);

Kev.

---------------------------------------------------------------------------
Kevin Jones k...@mlkeeley.demon.co.uk
Missing Link Software plc.
---------------------------------------------------------------------------


0 new messages