thank your answer very much Espen
I googled MSDN and watched some text
screen-DC and print-DC and so on are common-DC
DC of window you created is private-DC
and GetDC to get DC from
Cache
(windows memory)
when it is out of all space of
Cache
the next GetDC will alloc DC-memory from
heap
of your program,
till all available space of memory is taken.
but DC be gotten from
heap
, will be fail to release.
this is why you have to Release a DC
So I tried to get
200 screen-hdc at one time, and they worked pretty well
int i ;
static HDC hdc[200] ;
for (i = 0 ; i < 200 ; i++)
hdc[i] = GetDC (NULL) ;
for (i = 0 ; i < 200 ; i++)
Rectangle (hdc[i], 0, 0, 500 - i * 2, 500 - i * 2) ;
for (i = 0 ; i < 200 ; i++)
if (!ReleaseDC (NULL, hdc[i]))
MessageBox (hwnd, TEXT ("failed to release"), NULL, MB_OK) ;
difference between
common-DC
and
private-DC
attributes of common-DC you get every time are alway unchanged.
but private-DC could remember attributes modifed by last time.
arosed My problem isn't out of
Cache
it is
LockWindowUpdate(hwndScreen)
(it will disable or enable hwndscreen)
or the screen resolution has been changed
my hdc isn't available anymore