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