Share via


DIRECT3D Attributes Sample: Demonstrates Using Direct3D

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

Security noteSecurity Note

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To get samples and instructions for installing them:

To access samples from Visual Studio

  • On the Help menu, click Samples.

    By default, these samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\.

  • For the most recent version of this sample and a list of other samples, see Visual Studio Samples on the MSDN Web site.

Building and Running the Sample

To build and run this sample

  1. Open the solution file Direct3D.sln.

  2. From the Build menu, click Build Solution.

  3. 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.

See Also

Other Resources

ATL Attributes Samples