Results 1 to 7 of 7

Thread: Releasing DC memory

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    USA all the way!
    Posts
    82

    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?
    Often talked of, never seen,
    Ever coming, never been,
    Daily looked for, never here,
    Still approaching, coming near,
    Thousands for its visit wait,
    But alas for their fate,
    Tho' they expect me to appear,
    They will never find me here.

    What's this about?

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    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

  3. #3
    Lively Member
    Join Date
    Sep 2001
    Posts
    74

    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.
    All will fall before the might of the Black Sashi...

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    USA all the way!
    Posts
    82
    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?
    Often talked of, never seen,
    Ever coming, never been,
    Daily looked for, never here,
    Still approaching, coming near,
    Thousands for its visit wait,
    But alas for their fate,
    Tho' they expect me to appear,
    They will never find me here.

    What's this about?

  5. #5
    New Member
    Join Date
    May 2002
    Location
    Gers France
    Posts
    8
    You can try this API function

    Code:
    Public Declare Function DeleteDC Lib "gdi32" _
                        (ByVal hdc As Long) As Long

  6. #6
    jim mcnamara
    Guest
    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.


    Assuming I understood what you meant.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    USA all the way!
    Posts
    82
    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.)
    Often talked of, never seen,
    Ever coming, never been,
    Daily looked for, never here,
    Still approaching, coming near,
    Thousands for its visit wait,
    But alas for their fate,
    Tho' they expect me to appear,
    They will never find me here.

    What's this about?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width