[API]
CreateCompatibleDC
DeleteDC
RestoreDC
SaveDC
SelectObject

[CODE]
Public Function Bitmap_GetDC(ByVal hBitmap As Long) As Long
  Bitmap_GetDC = CreateCompatibleDC(0&)
  If Not Bitmap_GetDC = 0& Then
    If SaveDC(Bitmap_GetDC) = 1& Then
      If Not SelectObject(Bitmap_GetDC, hBitmap) = 0& Then
        GoTo Success
        End If
      Call RestoreDC(Bitmap_GetDC, 1&)
      End If
    Call DeleteDC(Bitmap_GetDC)
    Bitmap_GetDC = 0&
    End If
Success:
  End Function

Public Function Bitmap_ReleaseDC(ByVal hBitmap As Long, ByVal hDC As Long)
  Call RestoreDC(hDC, 1&)
  Call DeleteDC(hDC)
  End Function
