Objects and Interfaces

Calling the IObjectName::QueryInterface method retrieves a valid interface pointer only if the object supports that interface; therefore, you could call the IDirect3DRMDevice::QueryInterface method to retrieve the IDirect3DRMWinDevice interface, but not to retrieve the IDirect3DRMVisual interface.

Object name Supported interfaces
Direct3DRMAnimation IDirect3DRMAnimation
Direct3DRMAnimationSet IDirect3DRMAnimationSet
Direct3DRMDevice IDirect3DRMDevice, IDirect3DRMWinDevice
Direct3DRMDevice2 IDirect3DRMDevice2, IDirect3DRMWinDevice
Direct3DRMFace IDirect3DRMFace
Direct3DRMFrame IDirect3DRMFrame, IDirect3DRMVisual
Direct3DRMFrame2 IDirect3DRMFrame2, IDirect3DRMVisual
Direct3DRMInterpolator IDirect3DRInterpolator
Direct3DRMLight IDirect3DRMLight
Direct3DRMMaterial IDirect3DRMMaterial
Direct3DRMMesh IDirect3DRMMesh, IDirect3DRMVisual
Direct3DRMProgressiveMesh IDirect3DRMProgressiveMesh, IDirect3DRMVisual
Direct3DRMMeshBuilder IDirect3DRMMeshBuilder, IDirect3DRMVisual
Direct3DRMMeshBuilder2 IDirect3DRMMeshBuilder2, IDirect3DRMVisual
Direct3DRMShadow IDirect3DRMShadow, IDirect3DRMVisual
Direct3DRMTexture IDirect3DRMTexture, IDirect3DRMTexture2, IDirect3DRMVisual
Direct3DRMUserVisual IDirect3DRMUserVisual, IDirect3DRMVisual
Direct3DRMViewport IDirect3DRMViewport
Direct3DRMWrap IDirect3DRMWrap

The following example illustrates how to create two interfaces to a single Direct3DRMDevice object. The IDirect3DRM::CreateObject method creates an uninitialized Direct3DRMDevice object. The IDirect3DRMDevice::InitFromClipper method initializes the object. The call to the IDirect3DRMDevice::QueryInterface method creates a second interface to the Direct3DRMDevice object-an IDirect3DRMWinDevice interface the application will use to handle WM_PAINT and WM_ACTIVATE messages.

d3drmapi->CreateObject(CLSID_CDirect3DRMDevice, NULL,

IID_IDirect3DRMDevice,(LPVOID FAR*)&dev1);

dev1->InitFromClipper(lpDDClipper, IID_IDirect3DRMDevice,

r.right, r.bottom);

dev1->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &dev2);

To determine if two interfaces refer to the same object, call the QueryInterface method of each interface and compare the values of the pointers they return. If the pointer values are the same, the interfaces refer to the same object.

All Direct3D Retained-Mode objects support the IDirect3DRMObject and IUnknown interfaces in addition to the interfaces in the preceding list. Array objects are not derived from IDirect3DRMObject. Array objects have no class identifiers (CLSIDs) because they are not needed. Applications cannot create array objects in a call to the IDirect3DRM::CreateObject method; instead, they should use the creation methods listed below for each interface:

Array interface Creation method
IDirect3DRMDeviceArray IDirect3DRM::GetDevices
IDirect3DRMFaceArray IDirect3DRMMeshBuilder::GetFaces or IDirect3DRMMeshBuilder2::GetFaces
IDirect3DRMFrameArray IDirect3DRMPickedArray::GetPick, IDirect3DRMPicked2Array::GetPick, or IDirect3DRMFrame::GetChildren
IDirect3DRMLightArray IDirect3DRMFrame::GetLights
IDirect3DRMObjectArray IDirect3DRMInterpolator::GetAttachedObjects
IDirect3DRMPickedArray IDirect3DRMViewport::Pick
IDirect3DRMPicked2Array IDirect3DRMFrame2::RayPick
IDirect3DRMViewportArray IDirect3DRM::CreateFrame
IDirect3DRMVisualArray IDirect3DRMFrame::GetVisuals