 'Debug.Assert (lR &lt;&gt; -1)
              AddFromHandle lhBmp, IMAGE_BITMAP, vKey, lBackColor
                  
              DeleteObject lhBmp
          End If
          ' Clear up the DC:
          DeleteDC lHDC
      End If
   End If

   If (lR &lt;&gt; -1) Then
        SetKey lR, vKey
   End If
   pEnsureKeys
   AddFromPictureBox = lR + 1
   
End Function
Private Sub pEnsureKeys()
Dim iCount As Long
Dim iU As Long
   If m_hIml &lt;&gt; 0 Then
      iCount = ImageCount
      On Error Resume Next
  