INFO: Using Device Contexts Across Threads (94236)
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API)
- Microsoft Windows NT Workstation 3.1
- Microsoft Windows NT Workstation 3.5
- Microsoft Windows NT Workstation 3.51
This article was previously published under Q94236
3.10 3.50 3.51
WINDOWS NT
kbgraphic
SUMMARY
A window created with the CS_OWNDC style retains its device context (DC)
attributes across GetDC() calls.
However, the DC attributes are not retained if the GetDC() calls are called
from different threads. This is by design because DCs are thread-based. In
the Win32 user interface, if the calling thread is not the owner of the
window, then GetDC() returns a cache DC instead of the owned DC handle.
To save attributes across threads, one must create a routine to initialize
DC attributes, which is then called from threads not owning the given
window.
Modification Type: | Minor | Last Reviewed: | 2/11/2005 |
---|
Keywords: | kbinfo KB94236 |
---|
|