共用方式為


CWindow::ReleaseDC

釋放裝置內容。

int ReleaseDC(
   HDC hDC 
);

備註

請參閱在 Windows SDK的 ReleaseDC

範例

// 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::GetDC

CWindow::GetDCEx

CWindow::GetWindowDC