Graphics::FromHDC(HDC,HANDLE) method (gdiplusgraphics.h)

The Graphics::FromHDC method creates a Graphics object that is associated with a specified device context and a specified device.

Syntax

Graphics * FromHDC(
  [in] HDC    hdc,
  [in] HANDLE hdevice
);

Parameters

[in] hdc

Type: HDD

Handle to the device context that is associated with the new Graphics object.

[in] hdevice

Type: HANDLE

Handle to a device that is associated with the new Graphics object.

Return value

Type: Graphics*

This method returns a pointer to the new Graphics object.

Remarks

When you use this method to create a Graphics object, make sure that the Graphics object is deleted before the device context is released.

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusgraphics.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Changes in the Programming Model

FromHDC Methods

Graphics

Graphics Constructors

Graphics::FromHWND

Graphics::FromImage

Graphics::GetHDC

Optimizing Printing by Providing a Printer Handle