MSDN上的说明 GetDC GetWindowDC
Parameters
hWnd
[in] Handle to the window with a device context that is to be retrieved. If this value is NULL, GetWindowDC retrieves the device context for the entire screen.
Windows 98/Me, Windows 2000/XP: If this parameter is NULL, GetWindowDC retrieves the device context for the primary display monitor.
一个窗口 一个 DC
int ReleaseDC(HWND hWnd, HDC hdc);要知道 那个 窗口 的 DC
窗口 类 的
CWnd::ReleaseDC
int ReleaseDC( CDC* pDC );
全局 的
ReleaseDC
The ReleaseDC function releases a device context (DC), freeing it for use by other applications. The effect of the ReleaseDC function depends on the type of device context. It frees only common and window device contexts. It has no effect on class or private device contexts.
int ReleaseDC(
HWND hWnd, // handle to window
HDC hDC // handle to device context
);
GetDC
The GetDC function retrieves a handle to a display device context for the client area of a specified window or for the entire screen. You can use the returned handle in subsequent GDI functions to draw in the device context.
The GetDCEx function is an extension to GetDC, which gives an application more control over how and whether clipping occurs in the client area.
HDC GetDC( HWND hWnd // handle to a window
);
有了dc 就 可以 绘制了,即绘制是在 DC 上 进行的
The MoveToEx function updates the current position to the specified point and optionally returns the previous position.
BOOL MoveToEx(
HDC hdc, // handle to device context
int X, // x-coordinate of new current position
int Y, // y-coordinate of new current position
LPPOINT lpPoint // pointer to old current position
);