Microsoft Foundation Classes (mfc.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
CWnd::GetWindowDC
◄CWnd► ◄Up► ◄Contents► ◄Index► ◄Back►
──Microsoft Foundation Classes──────────────────────────────────────────────
CDC* GetWindowDC();
Remarks
Retrieves the display context for the entire window, including caption
bar, menus, and scroll bars. A window display context permits painting
anywhere in CWnd, since the origin of the context is the upper-left
corner of CWnd instead of the client area.
Assigns default attributes to the display context each time it retrieves
the context. Previous attributes are lost.
Intended to be used for special painting effects within the CWnd
nonclient area. Painting in nonclient areas of any window is not
recommended.
The ◄GetSystemMetrics► Windows function can be used to retrieve the
dimensions of various parts of the nonclient area, such as the caption
bar, menu, and scroll bars.
After painting is complete, the ◄ReleaseDC► member function must be
called to release the display context. Failure to release the display
context will seriously affect painting requested by applications due to
limitations on the number of device contexts that can be open at the
same time.
Return Value
Identifies the display context for the given window if the function is
successful; otherwise, the value is NULL.
The returned pointer may be temporary, and should not be stored for
later use.
See Also
◄::GetSystemMetrics►, ◄CWnd::ReleaseDC►, ◄::GetWindowDC►, ◄CWnd::GetDC►,
◄CWindowDC►
-♦-