-
Releasing DC memory
i created a whole bunch of DC mems for a game, and at the end i hafta write something like this:
form_unload
releasedc me.hwnd, front
releasedc me.hwnd, back
releasedc me.hwnd, tileset1
releasedc me.hwnd, charset
releasedc me.hwnd, level1texture
releasedc me.hwnd, level2texture
releasedc me.hwnd, gui
etc...
is there anything that can get rid of all created dc mem, like
ReleaseDC me.hWnd, ALL?
-
nope. you have to store the objects and release everything its a bit complicated.. search the forums, the code has been posted.. sorry no time
-
It can not be done
I've tryed every single codeing technique thats been posted on the subject here. They do not work. Try running them is an endless loop of creations and deletes and you'll see the problem.
Switch to DirectX or limit the amount created so memory doesn't run out. Would be my advice.
-
thnx for the help. I guess im stuck with what i have until i can find a "DirectX for dummies" site. Know of any good ones?
-
You can try this API function
Code:
Public Declare Function DeleteDC Lib "gdi32" _
(ByVal hdc As Long) As Long
-
You call DeleteDC only when you have called CreateDC earlier.
You call ReleaseDC when you have called GetDC.
GetDC uses an existing DC from the pool in memory - maintained by Windows. CreateDC makes a brand new one - more overhead, therefore slower.
If you keep calling DeleteDC after GetDC, you will eventually crash the system. ReleaseDC after CreateDC has similar problems.
:D
Assuming I understood what you meant.
-
i didn't know that, i will have to change some of my code now.
But my question was
1) can i delete all created dc's with just one call, or do i have to use a seperate call for each dc.
2) where can i find a directx tutorial for dummies/beginners
(i have no idea what directx is, but everyone keeps recommending it to me.)