[API]
CreateCompatibleBitmap
CreateCompatibleDC
DeleteDC
DeleteObject
GetCurrentObject
GetDC
SaveDC
ReleaseDC
RestoreDC
SelectObject
SetBitmapDimensionEx

[CODE]
Public Function DC_Create(ByVal Width As Long, ByVal Height As Long) As Long
  Dim hBmp As Long
  Dim hDC As Long
  
  hDC = GetDC(0&)
  If Not hDC = 0& Then
    hBmp = CreateCompatibleBitmap(hDC, Width, Height)
    Call ReleaseDC(0&, hDC)
    If Not hBmp = 0& Then
      If Not SetBitmapDimensionEx(hBmp, Width, Height, 0&) = 0& Then
        hDC = CreateCompatibleDC(0&)
        If Not hDC = 0& Then
          If SaveDC(hDC) = 1& Then
            If Not SelectObject(hDC, hBmp) = 0& Then
              DC_Create = hDC
              GoTo Success
              End If
            Call RestoreDC(hDC, 1&)
            End If
          Call DeleteDC(hDC)
          End If
        End If
      Call DeleteObject(hBmp)
      End If
    End If
Success:
  End Function

Public Function DC_Delete(ByRef hDC As Long)
  Dim hBmp As Long

  hBmp = GetCurrentObject(hDC, 7&)
  Call RestoreDC(hDC, 1&)
  Call DeleteDC(hDC)
  hDC = 0&
  If Not hBmp = 0& Then Call DeleteObject(hBmp)
  End Function
