ID2D1Factory::CreateHwndRenderTarget method

Creates an ID2D1HwndRenderTarget, a render target that renders to a window.

Syntax

virtual HRESULT CreateHwndRenderTarget(
  [in]  D2D1_RENDER_TARGET_PROPERTIES      *renderTargetProperties,
  [in]  D2D1_HWND_RENDER_TARGET_PROPERTIES *hwndRenderTargetProperties,
  [out] ID2D1HwndRenderTarget              **hwndRenderTarget
) = 0;

Parameters

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

When you create a render target and hardware acceleration is available, you allocate resources on the computer's GPU. By creating a render target once and retaining it as long as possible, you gain performance benefits. Your application should create render targets once and hold onto them for the life of the application or until the D2DERR_RECREATE_TARGET error is received. When you receive this error, you need to recreate the render target (and any resources it created).

Requirements

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]

Header

D2d1.h

Library

D2d1.lib

DLL

D2d1.dll

See also

ID2D1Factory

CreateHwndRenderTarget