[API]
GlobalAlloc
GlobalLock
GlobalUnlock
GlobalFree
CreateStreamOnHGlobal
OleLoadPicture
LocalAlloc
RtlMoveMemory

[INCLUDE]
OLEInterface_CallFunction
OLEInterface_Release
OLEFreePicture

[CODE]
Public Function OLELoadPictureFromString(ByVal PicData As String, ByRef hBitmap As Long) As Long
  Dim xLong1 As Long
  Dim lpMem  As Long
  Dim xLongA1(3) As Long
  Dim xType1 As OLELoadImageIData
  
  hBitmap = 0&
  xLong1 = Len(PicData)
  If Not xLong1 = 0& Then
    xType1.hMemG = GlobalAlloc(2&, xLong1)
    If Not xType1.hMemG = 0& Then
      lpMem = GlobalLock(xType1.hMemG)
      If lpMem Then
        Call RtlMoveMemory(ByVal lpMem, ByVal PicData, xLong1)
        Call GlobalUnlock(xType1.hMemG)
        If CreateStreamOnHGlobal(xType1.hMemG, 1&, ByVal VarPtr(xType1.IStream)) = 0& Then
          If Not xType1.IStream = 0& Then
            xLongA1(0) = &H7BF80980 '"{7BF80980-BF32-101A-8BBB-00AA00300CAB}"
            xLongA1(1) = &H101ABF32
            xLongA1(2) = &HAA00BB8B
            xLongA1(3) = &HAB0C3000
            Call OleLoadPicture(ByVal xType1.IStream, xLong1, 0&, VarPtr(xLongA1(0)), ByVal VarPtr(xType1.IPicture))
            If Not xType1.IPicture = 0& Then
'                    xLong1 = OLEInterface_GetProperty(xType1.IPicture, 8& * 4&)
              xLong1 = 0&
              'Stop
              If OLEInterface_CallFunction(xType1.IPicture, 12&, VarPtr(xLong1)) = 0& Then
              'Stop
                If Not xLong1 = 0& Then
                  OLELoadPictureFromString = LocalAlloc(0&, OLELoadImageIDataLen)
                  If Not OLELoadPictureFromString = 0& Then
                    Call RtlMoveMemory(ByVal OLELoadPictureFromString, xType1, OLELoadImageIDataLen)
                    hBitmap = xLong1
                    GoTo Success
                    End If
                  End If
                End If
              Call OLEInterface_Release(xType1.IPicture)
              End If
            Call OLEInterface_Release(xType1.IStream)
            End If
          End If
        End If
      Call GlobalFree(xType1.hMemG)
      End If
Success:
    End If
  End Function