Further to an earlier post I have made progress and can now display a DIB (Device Independent Bitmap) on a VB6 form using this code.
[CODE=vb] Set Field = Adodc1.Recordse t.Fields.Item(" Student_Photo")
If IsNull(Field.Va lue) = False Then
ByteArray() = Field.Value
hSizeIn = Field.ActualSiz e
'Copy the memory inside the Gobal memory
hMemIn = GlobalAlloc(GME M_SHARE, hSizeIn)
pMem = GlobalLock(hMem In)
CopyMemory ByVal pMem, ByteArray(0), hSizeIn
GlobalUnlock hMemIn
'Use the N5GetDibFunctio n to unpack the Blob
hMemOut = N5GetDib(hMemIn )
GlobalFree hMemIn
If hMemOut <> 0 Then
hSizeOut = GlobalSize(hMem Out)
pMem = GlobalLock(hMem Out)
ReDim ByteArray(hSize Out)
CopyMemory ByteArray(0), ByVal pMem, hSizeOut
CopyMemory BInfoHeader, ByteArray(0), Len(BInfoHeader )
StartDib = Len(BInfoHeader ) + PaleteSize(BInf oHeader)
CopyMemory ByVal pMem, ByteArray(Start Dib), hSizeOut - StartDib
hDibOpen = DrawDibOpen()
xSize = (Picture1.Width / Screen.TwipsPer PixelX)
ySize = (Picture1.Heigh t / Screen.TwipsPer PixelX)
If (hDibOpen <> 0) And (hDibOpen <> -1) Then
TempResult = DrawDibDraw(hDi bOpen, Picture1.hDC, 0, 0, xSize, ySize, BInfoHeader, ByVal pMem, 0, 0, BInfoHeader.biW idth, BInfoHeader.biH eight, 0)
If TempResult = 0 Then
MsgBox "Error Drawing DIB"
End If
End If
End If[/CODE]
but I cannot find an equivalent in Access for picture.hDC, anyone have any idea?
[CODE=vb] Set Field = Adodc1.Recordse t.Fields.Item(" Student_Photo")
If IsNull(Field.Va lue) = False Then
ByteArray() = Field.Value
hSizeIn = Field.ActualSiz e
'Copy the memory inside the Gobal memory
hMemIn = GlobalAlloc(GME M_SHARE, hSizeIn)
pMem = GlobalLock(hMem In)
CopyMemory ByVal pMem, ByteArray(0), hSizeIn
GlobalUnlock hMemIn
'Use the N5GetDibFunctio n to unpack the Blob
hMemOut = N5GetDib(hMemIn )
GlobalFree hMemIn
If hMemOut <> 0 Then
hSizeOut = GlobalSize(hMem Out)
pMem = GlobalLock(hMem Out)
ReDim ByteArray(hSize Out)
CopyMemory ByteArray(0), ByVal pMem, hSizeOut
CopyMemory BInfoHeader, ByteArray(0), Len(BInfoHeader )
StartDib = Len(BInfoHeader ) + PaleteSize(BInf oHeader)
CopyMemory ByVal pMem, ByteArray(Start Dib), hSizeOut - StartDib
hDibOpen = DrawDibOpen()
xSize = (Picture1.Width / Screen.TwipsPer PixelX)
ySize = (Picture1.Heigh t / Screen.TwipsPer PixelX)
If (hDibOpen <> 0) And (hDibOpen <> -1) Then
TempResult = DrawDibDraw(hDi bOpen, Picture1.hDC, 0, 0, xSize, ySize, BInfoHeader, ByVal pMem, 0, 0, BInfoHeader.biW idth, BInfoHeader.biH eight, 0)
If TempResult = 0 Then
MsgBox "Error Drawing DIB"
End If
End If
End If[/CODE]
but I cannot find an equivalent in Access for picture.hDC, anyone have any idea?