[API]
CreateCompatibleDC
StretchBlt
SetStretchBltMode
BitBlt
SelectObject
SetDIBits
DeleteDC
GetObjectA

[CODE]
Public Function DrawBitmapStretched(ByVal DestHDc As Long, ByVal hBitmap As Long, Optional ByVal OffsetLeft As Long = 0&, Optional ByVal OffsetTop As Long = 0&, Optional ByRef Width As Long = 0&, Optional ByRef Height As Long = 0&) As Boolean
  Dim hBmpOld As Long
  Dim hDC As Long
  Dim xLongA1(6) As Long
  
  If Not hBitmap = 0& Then
    If Not GetObjectA(hBitmap, 28&, ByVal VarPtr(xLongA1(0))) = 0& Then
      hDC = CreateCompatibleDC(0&)
      If Not hDC = 0& Then
        hBmpOld = SelectObject(hDC, hBitmap)
        If Not hBmpOld = 0& Then
          If Width < 1& Then Width = xLongA1(1)
          If Height < 1& Then Height = xLongA1(2)
          If Width = xLongA1(1) And Height = xLongA1(2) Then
            DrawBitmapStretched = (Not BitBlt(DestHDc, OffsetLeft, OffsetTop, Width, Height, hDC, 0&, 0&, vbSrcCopy) = 0&)
            else
            Call SetStretchBltMode(DestHDc, 4&)
            DrawBitmapStretched = (Not StretchBlt(DestHDc, OffsetLeft, OffsetTop, Width, Height, hDC, 0&, 0&, xLongA1(1), xLongA1(2), vbSrcCopy) = 0&)
            Call SetStretchBltMode(DestHDc, 3&)
            End If
          Call SelectObject(hDC, hbmpold)
          End If
        Call DeleteDC(hDC)
        End If
      End If
    End If
  End Function
