DIRECT3D Attributes Sample: Demonstrates Using Direct3D

The DIRECT3D attributes sample creates a control that draws a spinning triangle using the Direct3D graphics library.

The DIRECT3D sample is the nonattributed version of this sample.

Security Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices.

Building and Running the Sample

To build and run this sample

  1. Note: You must have the Direct3D SDK installed in order to build this sample.

  2. Open the solution file Direct3D.sln.

  3. From the Build menu, click Build Solution.

  4. After the sample builds, open Direct3D.htm in your Web browser.

You can test the control in the ActiveX Control Test Container. For details on accessing Test Container and using it to test a control, see Testing Properties and Events with Test Container.

Attributes

This sample uses the following attributes:

coclass, default, dll, dual, helpstring, implements_category, module, name, object, pointer_default, progid, registration_script, support_error_info, uuid, vi_progid

Keywords

This sample uses the following keywords:

Apartment; ATLASSERT; ATLTRACE; AtlWaitWithMessageLoop; BEGIN_COM_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComControlBase::InPlaceActivate; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; CException::ReportError; CoGetInterfaceAndReleaseStream; CoInitialize; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; COM_INTERFACE_ENTRY_IMPL_IID; CoMarshalInterThreadInterfaceInStream; CopyMemory; CoUninitialize; CreatePalette; CreateRectRgn; CreateThread; D3DEXECUTEBUFFERDESC; DDSURFACEDESC; DDSURFACEDESC; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_REGISTRY_RESOURCEID; DirectDrawCreate; DirectDrawCreateClipper; DisableThreadLibraryCalls; END_OBJECT_MAP; GetClientRect; GetOurWindow; GetSystemPaletteEntries; IDataObjectImpl; IDirect3D::CreateLight; IDirect3D::CreateMaterial; IDirect3D::CreateViewport; IDirect3DDevice::AddViewport; IDirect3DDevice::BeginScene; IDirect3DDevice::CreateMatrix; IDirect3DDevice::DeleteMatrix; IDirect3DDevice::EndScene; IDirect3DDevice::Execute; IDirect3DViewport::AddLight; IDirect3DViewport::CreateMatrix; IDirect3DViewport::SetBackground; IDirect3DViewport::SetMatrix; IDirectDraw2::EnumDevices; IDirectDraw2::SetCooperativeLevel; IDirectDrawClipper::SetHWnd; IDirectDrawSurface2::AddAttachedSurface; IDirectDrawSurface2::GetSurfaceDesc; IDirectDrawSurface2::Restore; IDirectDrawSurface2::SetClipper; IDispatchImpl; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleInPlaceObjectWindowlessImpl::InPlaceDeactivate; IOleInPlaceObjectWindowlessImpl::SetObjectRects; IOleObjectImpl; IPersistStorageImpl; IPersistStreamInitImpl; IProvideClassInfo2Impl; IQuickActivateImpl; ISupportErrorInfo; IViewObjectExImpl; LPD3DDEVICEDESC; LPD3DINSTRUCTION; LPD3DPROCESSVERTICES; LPD3DSTATE; LPD3DTRIANGLE; LPD3DVERTEX; LPDIRECTDRAWCLIPPER ; MessageBox; OBJECT_ENTRY; OffsetRect; OnEraseBackground; PALETTEENTRY; QueryInterface; RenderScene; SelectClipRgn; SetPalette; WindowFromDC; ZeroMemory

Note

Some of the samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task.