Each time when I click on a command button, the procedure commandbutton_click is executed...

Inside the commandbutton_click procedures, a mask image and sprite image will be generated using the GenerateDC and BitBlt function and it'll move 10 pixels left.

therefore, whenever the commandbutton is click, a sprite will be generated and it'll move around the screen 10 pixels left

now the problem is, after hundreds time clicking the button, the 'low memory' or 'low resources' message is displayed.

Although, i've added deleteDC function in every click, the problem never subside.
To make the matter worse, after exiting the program, the windows will be messed up... signs of not enough memory...

Can anyone help me?

Code:
Private Sub CommandButton_Click()
Dim Move
Move = 10
Move = Move + 10

'load images
DCMask = GenerateDC("c:\1m.bmp")

If DCMask <= 0 Then
    MsgBox "Failure in creating mask dc"
    Exit Sub
End If

DCSprite = GenerateDC("c:\1.bmp")

If DCSprite <= 0 Then
    MsgBox "Failure in creating sprite dc"
    'Clean up after the created mask
    DeleteGeneratedDC DCMask
End If

'add the sprite and the mask

BitBlt Me.hdc, 0, Move, 30, 30, DCMask, 0, 0, vbSrcAnd
BitBlt Me.hdc, 0, Move, 30, 30, DCSprite, 0, 0, vbSrcPaint

'delete the images after generated
DeleteGeneratedDC DCMask
DeleteGeneratedDC DCSprite

frmTest.Cls
frmtest.Refresh

This is not the real code, but just to give you the main idea
Any suggestion?