Share via


CWindow::GetDC

クライアント領域のデバイス コンテキストを取得します。

HDC GetDC( ) throw();

解説

Windows SDKの GetDC を参照してください。

使用例

// The following example attaches a HWND to the CWindow object,
// calls CWindow::GetDC to retrieve the DC of the client
// area of the window wrapped by CWindow Object, and calls
// CWindow::ReleaseDC to release the DC. 

CWindow myWindow;
myWindow.Attach(hWnd);   
HDC hDC = myWindow.GetDC();

// Use the DC

myWindow.ReleaseDC(hDC);
hDC = NULL;

必要条件

Header: atlwin.h

参照

関連項目

CWindow クラス

CWindow::GetDCEx

CWindow::GetWindowDC

CWindow::ReleaseDC