XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

How do I pass an ID3D10Device ptr to inprocess ATL COM object and have it work

Last post 21/10/2009 3:53 by legalize. 1 replies.
  • 07/10/2009 17:04

    How do I pass an ID3D10Device ptr to inprocess ATL COM object and have it work

    I've tried to pass the D3D10Device interface as an IUnknown and cast it to a CComPtr in an inprocess COM DLL but calls on the ptr fail.

    I also tried to pass the D3D10Device interface as an IUnknown and cast it back to a D3D10Device interface and calls on the ptr fail.

    My goal is to have separate DLLs manage parts of a frame: stars in one DLL, sun in another, earth terrain in a third.

    Ex:

     

       hr = DXUTCreateBox( pIDevice, P1, P2, P3, &m_pMesh );

     

    The error msg is an access violation on some hidden ptr in directx with a zero value.  No hr is returned.

    If I keep everything inprocess, I don't see why directx should care.

    Can anyone help? 

     

  • 21/10/2009 3:53 In reply to

    Re: How do I pass an ID3D10Device ptr to inprocess ATL COM object and have it work

    The easiest thing is to use strongly typed pointers. Why are you trying to use IUnknown?

    Also you say you are casting the IUnknown pointer. COM doesn't work this way. You have to use QueryInterface if you want to get from IUnknown to some other interface. Generally things aren't done this way in D3D, so its unclear if QueryInterface is going to do what you expect (it should, but I haven't tried it.)

    You definately can't cast an IUnknown interface pointer to a CComPtr.

Page 1 of 1 (2 items) Previous Next