INFO: Using Device Contexts Across Threads

ID: Q94236

3.10 3.50 3.51 WINDOWS NT kbgraphic
The information in this article applies to:


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.

Additional query words: 3.10


Keywords          : kbNTOS310 kbNTOS350 kbNTOS351 kbWin32s 
Version           : winnt:3.1,3.5,3.51
Platform          : winnt 
Issue type        : kbinfo 

Last Reviewed: June 14, 1999