Here is something I've been struggling with for a long time.
Below is the code that generates memory dc's (in type long variables) for a game I'm writting.
For the most part I just hold the same dc's in memory once they are created so everything runs fast. But what I would like to be able to do is delete certain dc's, and then replace them with different pictures so like if you change clothes only one set of clothing dc's will be in memory at a time.
Currently not only does putting a new dc into the long variable NOT save memory but it also compleatly screws up the the sprites ability to display correctly. Any help would be appreciated.
Public Function GenerateDC(Sprite As String)
Dim DC As Long, pictemp As IPictureDisp
DC = CreateCompatibleDC(0)
'If DC < 1 Then
' Exit Function
'End If
Set pictemp = LoadResPicture(Sprite, bitmap)
SelectObject DC, pictemp
DeleteObject pictemp
Set pictemp = Nothing
GenerateDC = DC
End Function
Private Sub createDCs()
Stance1s = GenerateDC("STANCE1S")
Stance2s = GenerateDC("STANCE2S")
Stance3s = GenerateDC("STANCE3S")
Stance1m = GenerateDC("STANCE1M")
'---------many more of these...
end sub
