Archived

This topic is now archived and is closed to further replies.

Elandsong

Can I get a pointer to an IDirect3D9 interface by Calling CoCreateInstance ?

Recommended Posts

I can get a pointer to an IDirectInput8 interface by calling DirectInput8Create or CoCreateInstance, that''s OK. For instance: IDirectInput8* iDInput = NULL; //1: DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&iDInput, NULL); //2: CoCreateInstance(CLSID_DirectInput8, NULL, CLSCTX_INPROC, IID_IDirectInput8, (void**)&iDInput); Just like the 1st method above, I can get a pointer to an IDirect3D9 interface by calling Direct3DCreate9 as the following. IDirect3D9 *iD3D = Direct3DCreate9(D3D_SDK_VERSION); Is there anyway to get a pointer to an IDirect3D9 interface by calling CoCreateInstance ? Thanks.

Share this post


Link to post
Share on other sites
Well, I haven''t done it that way (and wouldn''t) but it ought to work.. DX is based on COM and thus has to follow all the COM rules .. it will be based on IUnknown and thus will expose its interfaces thru QueryInterface, like any COM object.

Share this post


Link to post
Share on other sites