473,779 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PictureData to StdPicture

I'm trying to load image data stored in an OLE field into an image
list, that will be used by a treeview to show icons. This is at run
time.

To do this, I'm trying to load the field which contains the picturedata
into my image list by using a function that converts the picturedata
into what I believe is a stdpicture.

The Access errors out with "invalid picture".

When I look at the actual objPicture while debugging, it shows the
image height and width to be 847 by 847, which makes me believe at
least part of the code is working.

The function SetImgList calls FPictureDatatoS tdPicture (far below). The
code errors out with invalid picture on the following line of code:

imgX.ListImages .Add , Key:=rst("key") , Picture:=objPic ture
Any ideas... most of the code was borrowed from the lebans website. I
believe what I need is a PictureDatatoSt dPicture function that actually
works or a better understanding for the types of objects that an
imagelist can load. I've been struggling with this for two weeks now so
any help would be greatly appreciated..
Public Function SetImgList()
Dim imgX, imgY As Object
Dim objPicture As StdPicture
Dim icoPicture As StdPicture
Dim rst As Recordset
Dim objPic As Object
Dim PictureData As Variant
Dim handle, handle2 As Long
Dim AccessImage As Access.image
Dim ipd As IPictureDisp
Set AccessImage = Me.Image77
AccessImage.Vis ible = True
Set imgX = Me.ImgList.Obje ct
imgX.ListImages .Clear
Set imgY = Me.ImageList6.O bject
imgY.ListImages .Clear
'On Error GoTo SetImgListErr
Set rst = CurrentDb.OpenR ecordset("icons ")
If rst.RecordCount <> 0 Then
Do While Not rst.EOF
AccessImage.Pic tureData = rst("picturedat a")
PictureData = rst("picturedat a")
Set objPicture = FPictureDataToS tdPicture(Pictu reData)
imgX.ListImages .Add , Key:=rst("key") , Picture:=objPic ture
rst.MoveNext
Loop
Set objPicture = Nothing
Set icoPicture = Nothing
rst.Close
End If
Set rst = Nothing
Set imgX = Nothing
GoTo Done
SetImgListErr:
APGDebug (Err.Number & " " & Err.Description )
Done:
End Function

Function FPictureDataToS tdPicture(Pictu reData As Variant) As IPicture
' Memory Vars
Dim hGlobalMemory As Long
Dim lpGlobalMemory As Long
Dim hClipMemory As Long

'Fill picture description
Dim lngRet As Long
Dim IPic As IPicture, picdes As PictDesc, iidIPicture As IID
' Cf_metafilepict structure
Dim cfm As MetaFilePict

' Handle to a Memory Metafile
Dim hMetafile As Long

' Which ClipBoard format is contained in the PictureData prop
Dim CBFormat As Long

' Byte array to hold the PictureData prop
Dim bArray() As Byte

' Temp var
'On Error GoTo Err_PtoC

' Resize to hold entire PictureData prop
ReDim bArray(LenB(Pic tureData) - 1)
APGDebug "Len of PictureData=" & (LenB(PictureDa ta) - 1)
' Copy to our array
bArray = PictureData

' Determine which ClipBoard format we are using
Select Case bArray(0)
Case 40
' This is a straight DIB.
CBFormat = CF_DIB
' MSDN states to Allocate moveable|Shared Global memory
' for ClipBoard operations.
hGlobalMemory = GlobalAlloc(GME M_MOVEABLE Or GMEM_SHARE Or
GMEM_ZEROINIT, UBound(bArray) + 1)
If hGlobalMemory = 0 Then _
Err.Raise vbObjectError + 515, "ImageToClipBoa rd.modImageToCl ipBoard",
_
"GlobalAllo c Failed..not enough memory"

' Lock this block to get a pointer we can use to this memory.
lpGlobalMemory = GlobalLock(hGlo balMemory)
If lpGlobalMemory = 0 Then _
Err.Raise vbObjectError + 516, "ImageToClipBoa rd.modImageToCl ipBoard",
_
"GlobalLock Failed"

' Copy DIB as is in its entirety
apiCopyMemory ByVal lpGlobalMemory, bArray(0), UBound(bArray) + 1

' Unlock the memory and then copy to the clipboard
If GlobalUnlock(hG lobalMemory) <> 0 Then _
Err.Raise vbObjectError + 517, "ImageToClipBoa rd.modImageToCl ipBoard",
_
"GlobalUnLo ck Failed"
Case CF_ENHMETAFILE
' New Enhanced Metafile(EMF)
CBFormat = CF_ENHMETAFILE
hMetafile = SetEnhMetaFileB its(UBound(bArr ay) + 1 - 8, bArray(8))
Case CF_METAFILEPICT
' Old Metafile format(WMF)
CBFormat = CF_METAFILEPICT
' Copy the Metafile Header over to our Local Structure
apiCopyMemory cfm, bArray(8), Len(cfm)
' Let's convert older WMF to EMF.
' Allows us to have a single solution for Metafiles.
' 24 is the number of bytes in the sum of the
' METAFILEPICT structure and the 8 byte ClipBoard Format struct.
hMetafile = SetWinMetaFileB its(UBound(bArr ay) + 24 + 1 - 8, bArray(24),
0&, cfm)
Case Else
'Should not happen
Err.Raise vbObjectError + 514, "ImageToClipBoa rd.modImageToCl ipBoard",
_
"Unrecogniz ed PictureData ClipBoard format"

End Select

' Can we open the ClipBoard.
If OpenClipboard(0 &) = 0 Then _
Err.Raise vbObjectError + 518, "ImageToClipBoa rd.modImageToCl ipBoard",
_
"OpenClipBo ard Failed"

' Always empty the ClipBoard First. Not the friendliest thing
' to do if you have several programs interacting!
Call EmptyClipboard

' Now set the Image to the ClipBoard
If CBFormat = CF_ENHMETAFILE Or CBFormat = CF_METAFILEPICT Then

' Remember we can use this logic for both types of Metafiles
' because we converted the older WMF to the newer EMF.
'hClipMemory = SetClipboardDat a(CF_ENHMETAFIL E, hMetafile)

picdes.Size = Len(picdes)
picdes.type = vbPicTypeEMetaf ile
picdes.hBmp = hMetafile

' No palette info here
' Everything is 24bit for now

'picdes.hPal = hPal
' ' Fill in magic IPicture GUID
{7BF80980-BF32-101A-8BBB-00AA00300CAB}
iidIPicture.Dat a1 = &H7BF80980
iidIPicture.Dat a2 = &HBF32
iidIPicture.Dat a3 = &H101A
iidIPicture.Dat a4(0) = &H8B
iidIPicture.Dat a4(1) = &HBB
iidIPicture.Dat a4(2) = &H0
iidIPicture.Dat a4(3) = &HAA
iidIPicture.Dat a4(4) = &H0
iidIPicture.Dat a4(5) = &H30
iidIPicture.Dat a4(6) = &HC
iidIPicture.Dat a4(7) = &HAB
'' Create picture from bitmap handle
lngRet = OleCreatePictur eIndirect(picde s, iidIPicture, True, IPic)
'' Result will be valid Picture or Nothing-either way set it
Set FPictureDataToS tdPicture = IPic


Else
'' We are dealing with a standard DIB.
hClipMemory = SetClipboardDat a(CBFormat, hGlobalMemory)

End If

Exit_PtoC:
Exit Function
Err_PtoC:
Set FPictureDataToS tdPicture = Nothing
APGDebug Err.Description & Err.Source & ":" & Err.Number
Resume Exit_PtoC

End Function

Nov 13 '05 #1
3 14443
You need to clarify exactly what you are trying to do here. You state
that you need to process the data from an OLE field but then you try to
shove this data into the PictureData prop of an Image control not an OLE
Frame control.
How was the data stored in the OLE field? What exactly is the format of
the data?

If you have a valid PictureData prop then there is a SysCmd method
available that will return a StdPicture interface from the contents of
an Image control.

Dim pic As stdole.IPicture Disp
set pic = SysCmd(712,Name ofYourImageCont rolHere)

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
<tr******@gmail .com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
I'm trying to load image data stored in an OLE field into an image
list, that will be used by a treeview to show icons. This is at run
time.

To do this, I'm trying to load the field which contains the picturedata into my image list by using a function that converts the picturedata
into what I believe is a stdpicture.

The Access errors out with "invalid picture".

When I look at the actual objPicture while debugging, it shows the
image height and width to be 847 by 847, which makes me believe at
least part of the code is working.

The function SetImgList calls FPictureDatatoS tdPicture (far below). The code errors out with invalid picture on the following line of code:

imgX.ListImages .Add , Key:=rst("key") , Picture:=objPic ture
Any ideas... most of the code was borrowed from the lebans website. I
believe what I need is a PictureDatatoSt dPicture function that actually works or a better understanding for the types of objects that an
imagelist can load. I've been struggling with this for two weeks now so any help would be greatly appreciated..
Public Function SetImgList()
Dim imgX, imgY As Object
Dim objPicture As StdPicture
Dim icoPicture As StdPicture
Dim rst As Recordset
Dim objPic As Object
Dim PictureData As Variant
Dim handle, handle2 As Long
Dim AccessImage As Access.image
Dim ipd As IPictureDisp
Set AccessImage = Me.Image77
AccessImage.Vis ible = True
Set imgX = Me.ImgList.Obje ct
imgX.ListImages .Clear
Set imgY = Me.ImageList6.O bject
imgY.ListImages .Clear
'On Error GoTo SetImgListErr
Set rst = CurrentDb.OpenR ecordset("icons ")
If rst.RecordCount <> 0 Then
Do While Not rst.EOF
AccessImage.Pic tureData = rst("picturedat a")
PictureData = rst("picturedat a")
Set objPicture = FPictureDataToS tdPicture(Pictu reData)
imgX.ListImages .Add , Key:=rst("key") , Picture:=objPic ture
rst.MoveNext
Loop
Set objPicture = Nothing
Set icoPicture = Nothing
rst.Close
End If
Set rst = Nothing
Set imgX = Nothing
GoTo Done
SetImgListErr:
APGDebug (Err.Number & " " & Err.Description )
Done:
End Function

Function FPictureDataToS tdPicture(Pictu reData As Variant) As IPicture
' Memory Vars
Dim hGlobalMemory As Long
Dim lpGlobalMemory As Long
Dim hClipMemory As Long

'Fill picture description
Dim lngRet As Long
Dim IPic As IPicture, picdes As PictDesc, iidIPicture As IID
' Cf_metafilepict structure
Dim cfm As MetaFilePict

' Handle to a Memory Metafile
Dim hMetafile As Long

' Which ClipBoard format is contained in the PictureData prop
Dim CBFormat As Long

' Byte array to hold the PictureData prop
Dim bArray() As Byte

' Temp var
'On Error GoTo Err_PtoC

' Resize to hold entire PictureData prop
ReDim bArray(LenB(Pic tureData) - 1)
APGDebug "Len of PictureData=" & (LenB(PictureDa ta) - 1)
' Copy to our array
bArray = PictureData

' Determine which ClipBoard format we are using
Select Case bArray(0)
Case 40
' This is a straight DIB.
CBFormat = CF_DIB
' MSDN states to Allocate moveable|Shared Global memory
' for ClipBoard operations.
hGlobalMemory = GlobalAlloc(GME M_MOVEABLE Or GMEM_SHARE Or
GMEM_ZEROINIT, UBound(bArray) + 1)
If hGlobalMemory = 0 Then _
Err.Raise vbObjectError + 515, "ImageToClipBoa rd.modImageToCl ipBoard",
_
"GlobalAllo c Failed..not enough memory"

' Lock this block to get a pointer we can use to this memory.
lpGlobalMemory = GlobalLock(hGlo balMemory)
If lpGlobalMemory = 0 Then _
Err.Raise vbObjectError + 516, "ImageToClipBoa rd.modImageToCl ipBoard",
_
"GlobalLock Failed"

' Copy DIB as is in its entirety
apiCopyMemory ByVal lpGlobalMemory, bArray(0), UBound(bArray) + 1

' Unlock the memory and then copy to the clipboard
If GlobalUnlock(hG lobalMemory) <> 0 Then _
Err.Raise vbObjectError + 517, "ImageToClipBoa rd.modImageToCl ipBoard",
_
"GlobalUnLo ck Failed"
Case CF_ENHMETAFILE
' New Enhanced Metafile(EMF)
CBFormat = CF_ENHMETAFILE
hMetafile = SetEnhMetaFileB its(UBound(bArr ay) + 1 - 8, bArray(8))
Case CF_METAFILEPICT
' Old Metafile format(WMF)
CBFormat = CF_METAFILEPICT
' Copy the Metafile Header over to our Local Structure
apiCopyMemory cfm, bArray(8), Len(cfm)
' Let's convert older WMF to EMF.
' Allows us to have a single solution for Metafiles.
' 24 is the number of bytes in the sum of the
' METAFILEPICT structure and the 8 byte ClipBoard Format struct.
hMetafile = SetWinMetaFileB its(UBound(bArr ay) + 24 + 1 - 8, bArray(24), 0&, cfm)
Case Else
'Should not happen
Err.Raise vbObjectError + 514, "ImageToClipBoa rd.modImageToCl ipBoard",
_
"Unrecogniz ed PictureData ClipBoard format"

End Select

' Can we open the ClipBoard.
If OpenClipboard(0 &) = 0 Then _
Err.Raise vbObjectError + 518, "ImageToClipBoa rd.modImageToCl ipBoard",
_
"OpenClipBo ard Failed"

' Always empty the ClipBoard First. Not the friendliest thing
' to do if you have several programs interacting!
Call EmptyClipboard

' Now set the Image to the ClipBoard
If CBFormat = CF_ENHMETAFILE Or CBFormat = CF_METAFILEPICT Then

' Remember we can use this logic for both types of Metafiles
' because we converted the older WMF to the newer EMF.
'hClipMemory = SetClipboardDat a(CF_ENHMETAFIL E, hMetafile)

picdes.Size = Len(picdes)
picdes.type = vbPicTypeEMetaf ile
picdes.hBmp = hMetafile

' No palette info here
' Everything is 24bit for now

'picdes.hPal = hPal
' ' Fill in magic IPicture GUID
{7BF80980-BF32-101A-8BBB-00AA00300CAB}
iidIPicture.Dat a1 = &H7BF80980
iidIPicture.Dat a2 = &HBF32
iidIPicture.Dat a3 = &H101A
iidIPicture.Dat a4(0) = &H8B
iidIPicture.Dat a4(1) = &HBB
iidIPicture.Dat a4(2) = &H0
iidIPicture.Dat a4(3) = &HAA
iidIPicture.Dat a4(4) = &H0
iidIPicture.Dat a4(5) = &H30
iidIPicture.Dat a4(6) = &HC
iidIPicture.Dat a4(7) = &HAB
'' Create picture from bitmap handle
lngRet = OleCreatePictur eIndirect(picde s, iidIPicture, True, IPic)
'' Result will be valid Picture or Nothing-either way set it
Set FPictureDataToS tdPicture = IPic


Else
'' We are dealing with a standard DIB.
hClipMemory = SetClipboardDat a(CBFormat, hGlobalMemory)

End If

Exit_PtoC:
Exit Function
Err_PtoC:
Set FPictureDataToS tdPicture = Nothing
APGDebug Err.Description & Err.Source & ":" & Err.Number
Resume Exit_PtoC

End Function


Nov 13 '05 #2
Just in case this helps, my ultimate goal is to build an "icon chooser"
for a treeview control. There may be another solution when taking a
step back.

On to the code....

I had previously found that SysCmd command and tried it, but it
produces the same error message. Just for giggles, I've placed that
code below under SetImgListRev (renamed intentially to avoid confusion
in this thread). I tried it again at your suggestion and same error,
invalid picture.

I've been using "AddPicture " (below) to load the picturedata into the
OLE field in the first place. The files I am loading are icons, nothing
else at this stage.

I display the icons on a form using an image control using code similar
to Combo80_AfterUp date. This code works like a charm, so it looks like
I've at least got something valid in my OLE field.

Perhaps this situation is merely a limitation of the types of pictures
the imglist control can accept, or perhaps the imglist can't accept
images at run time?

Thanks, shohn
Private Sub Combo80_AfterUp date()
Dim rst As Recordset
Dim qry As QueryDef

Set qry = CurrentDb.Query Defs("GetIcon")
qry.parameters( "param1") = Nz(Me!Combo80, "invis") ' use blank icon if
we can't find anything
Set rst = qry.OpenRecords et
If rst.RecordCount <> 0 Then
Do While Not rst.EOF
Me.Image79.Pict ureData = rst("picturedat a")
rst.MoveNext
Loop
rst.Close
End If

Set qry = Nothing
Set rst = Nothing

End Sub


Sub AddPicture()
Dim imgX As ImageList
Dim striconame As String
Dim gotFile As Boolean
Dim pathname, extension, filename As String
Dim iconame As Variant
Dim objPicture As Object
Dim rs As Recordset

'On Error GoTo AddPictureError

If Not IsLoaded("Contr olReference") Then
DoCmd.OpenForm "ControlReferen ce"
Forms!ControlRe ference.Visible = False
End If
If IsLoaded("Contr olReference") Then

gotFile = VBGetOpenFileNa me(filename:=st riconame, InitDir:=DBPath )

If gotFile Then
If Len(striconame) <> 0 Then
extension = Right(striconam e, 3)
pathname = Left(striconame , InStrRev(strico name, "\"))
iconame = Split(filename, ".")
filename = Right(striconam e, Len(striconame) - Len(pathname))
'strip extension
filename = Left(filename, InStr(1, filename, ".") - 1)

If extension = "ico" Then

fStdPicToImageD ata hStdPic:=LoadPi cture(striconam e), ctl:=Me.Image75

Set rs = CurrentDb.OpenR ecordset("icons ")
rs.AddNew
rs("picturedata ") = Me.Image75.Pict ureData
APGDebug (filename)
rs("key") = filename
rs("tag") = filename
rs.Update
rs.Close
Me.Combo71.Requ ery
Me.Combo77.Requ ery
Me.Combo80.Requ ery

End If
End If
End If
End If

Exit Sub
AddPictureError :

APGDebug ("Err No:" & Err.Number & " " & Err.Description )
End Sub
Public Function SetImgList()
Dim imgX, imgY As Object
Dim objPicture As StdPicture
Dim icoPicture As StdPicture
Dim rst As Recordset
Dim objPic As Object
Dim PictureData As Variant
Dim handle, handle2 As Long
Dim AccessImage As Access.image
Dim ipd As stdOle.IPicture Disp
'AccessImage.Vi sible = True
Set imgX = Me.ImgList.Obje ct
imgX.ListImages .Clear
Set imgY = Me.ImageList6.O bject
imgY.ListImages .Clear
'On Error GoTo SetImgListErr
Set rst = CurrentDb.OpenR ecordset("icons ")
If rst.RecordCount <> 0 Then
Do While Not rst.EOF

Me.Image77.Pict ureData = rst("picturedat a")
Set ipd = SysCmd(712, Me.Image77)
imgX.ListImages .Add , Key:=rst("key") , Picture:=ipd
rst.MoveNext
Loop
Set ipd = Nothing
Set objPicture = Nothing
rst.Close
End If
Set rst = Nothing
Set imgX = Nothing
GoTo Done
SetImgListErr:
APGDebug (Err.Number & " " & Err.Description )
Done:
End Function

Private Sub LoadIcon()
Dim rst As Recordset
Dim qry As QueryDef

Set qry = CurrentDb.Query Defs("GetIcon")
qry.parameters( "param1") = Nz(Me!Combo80, "invis")
Set rst = qry.OpenRecords et
If rst.RecordCount <> 0 Then
Do While Not rst.EOF
Me.Image79.Pict ureData = rst("picturedat a")
rst.MoveNext
Loop
rst.Close
End If

Set qry = Nothing
Set rst = Nothing

End Sub


Public Function SetImgListRev()
Dim imgX, imgY As Object
Dim objPicture As StdPicture
Dim icoPicture As StdPicture
Dim rst As Recordset
Dim objPic As Object
Dim PictureData As Variant
Dim handle, handle2 As Long
Dim AccessImage As Access.image
Dim ipd As stdOle.IPicture Disp
'AccessImage.Vi sible = True
Set imgX = Me.ImgList.Obje ct
imgX.ListImages .Clear
Set imgY = Me.ImageList6.O bject
imgY.ListImages .Clear
'On Error GoTo SetImgListErr
Set rst = CurrentDb.OpenR ecordset("icons ")
If rst.RecordCount <> 0 Then
Do While Not rst.EOF

Me.Image77.Pict ureData = rst("picturedat a")
Set ipd = SysCmd(712, Me.Image77)
imgX.ListImages .Add , Key:=rst("key") , Picture:=ipd
rst.MoveNext
Loop
Set ipd = Nothing
Set objPicture = Nothing
rst.Close
End If
Set rst = Nothing
Set imgX = Nothing
GoTo Done
SetImgListErr:
APGDebug (Err.Number & " " & Err.Description )
Done:
End Function

Nov 13 '05 #3
Send me your MDB you are working with and I'll have a look at it for
you. My Email address is my first name @ my Domain name whihc
corresponds to my last name.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
<tr******@gmail .com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
Just in case this helps, my ultimate goal is to build an "icon chooser" for a treeview control. There may be another solution when taking a
step back.

On to the code....

I had previously found that SysCmd command and tried it, but it
produces the same error message. Just for giggles, I've placed that
code below under SetImgListRev (renamed intentially to avoid confusion
in this thread). I tried it again at your suggestion and same error,
invalid picture.

I've been using "AddPicture " (below) to load the picturedata into the
OLE field in the first place. The files I am loading are icons, nothing else at this stage.

I display the icons on a form using an image control using code similar to Combo80_AfterUp date. This code works like a charm, so it looks like
I've at least got something valid in my OLE field.

Perhaps this situation is merely a limitation of the types of pictures
the imglist control can accept, or perhaps the imglist can't accept
images at run time?

Thanks, shohn
Private Sub Combo80_AfterUp date()
Dim rst As Recordset
Dim qry As QueryDef

Set qry = CurrentDb.Query Defs("GetIcon")
qry.parameters( "param1") = Nz(Me!Combo80, "invis") ' use blank icon if
we can't find anything
Set rst = qry.OpenRecords et
If rst.RecordCount <> 0 Then
Do While Not rst.EOF
Me.Image79.Pict ureData = rst("picturedat a")
rst.MoveNext
Loop
rst.Close
End If

Set qry = Nothing
Set rst = Nothing

End Sub


Sub AddPicture()
Dim imgX As ImageList
Dim striconame As String
Dim gotFile As Boolean
Dim pathname, extension, filename As String
Dim iconame As Variant
Dim objPicture As Object
Dim rs As Recordset

'On Error GoTo AddPictureError

If Not IsLoaded("Contr olReference") Then
DoCmd.OpenForm "ControlReferen ce"
Forms!ControlRe ference.Visible = False
End If
If IsLoaded("Contr olReference") Then

gotFile = VBGetOpenFileNa me(filename:=st riconame, InitDir:=DBPath )

If gotFile Then
If Len(striconame) <> 0 Then
extension = Right(striconam e, 3)
pathname = Left(striconame , InStrRev(strico name, "\"))
iconame = Split(filename, ".")
filename = Right(striconam e, Len(striconame) - Len(pathname))
'strip extension
filename = Left(filename, InStr(1, filename, ".") - 1)

If extension = "ico" Then

fStdPicToImageD ata hStdPic:=LoadPi cture(striconam e), ctl:=Me.Image75

Set rs = CurrentDb.OpenR ecordset("icons ")
rs.AddNew
rs("picturedata ") = Me.Image75.Pict ureData
APGDebug (filename)
rs("key") = filename
rs("tag") = filename
rs.Update
rs.Close
Me.Combo71.Requ ery
Me.Combo77.Requ ery
Me.Combo80.Requ ery

End If
End If
End If
End If

Exit Sub
AddPictureError :

APGDebug ("Err No:" & Err.Number & " " & Err.Description )
End Sub
Public Function SetImgList()
Dim imgX, imgY As Object
Dim objPicture As StdPicture
Dim icoPicture As StdPicture
Dim rst As Recordset
Dim objPic As Object
Dim PictureData As Variant
Dim handle, handle2 As Long
Dim AccessImage As Access.image
Dim ipd As stdOle.IPicture Disp
'AccessImage.Vi sible = True
Set imgX = Me.ImgList.Obje ct
imgX.ListImages .Clear
Set imgY = Me.ImageList6.O bject
imgY.ListImages .Clear
'On Error GoTo SetImgListErr
Set rst = CurrentDb.OpenR ecordset("icons ")
If rst.RecordCount <> 0 Then
Do While Not rst.EOF

Me.Image77.Pict ureData = rst("picturedat a")
Set ipd = SysCmd(712, Me.Image77)
imgX.ListImages .Add , Key:=rst("key") , Picture:=ipd
rst.MoveNext
Loop
Set ipd = Nothing
Set objPicture = Nothing
rst.Close
End If
Set rst = Nothing
Set imgX = Nothing
GoTo Done
SetImgListErr:
APGDebug (Err.Number & " " & Err.Description )
Done:
End Function

Private Sub LoadIcon()
Dim rst As Recordset
Dim qry As QueryDef

Set qry = CurrentDb.Query Defs("GetIcon")
qry.parameters( "param1") = Nz(Me!Combo80, "invis")
Set rst = qry.OpenRecords et
If rst.RecordCount <> 0 Then
Do While Not rst.EOF
Me.Image79.Pict ureData = rst("picturedat a")
rst.MoveNext
Loop
rst.Close
End If

Set qry = Nothing
Set rst = Nothing

End Sub


Public Function SetImgListRev()
Dim imgX, imgY As Object
Dim objPicture As StdPicture
Dim icoPicture As StdPicture
Dim rst As Recordset
Dim objPic As Object
Dim PictureData As Variant
Dim handle, handle2 As Long
Dim AccessImage As Access.image
Dim ipd As stdOle.IPicture Disp
'AccessImage.Vi sible = True
Set imgX = Me.ImgList.Obje ct
imgX.ListImages .Clear
Set imgY = Me.ImageList6.O bject
imgY.ListImages .Clear
'On Error GoTo SetImgListErr
Set rst = CurrentDb.OpenR ecordset("icons ")
If rst.RecordCount <> 0 Then
Do While Not rst.EOF

Me.Image77.Pict ureData = rst("picturedat a")
Set ipd = SysCmd(712, Me.Image77)
imgX.ListImages .Add , Key:=rst("key") , Picture:=ipd
rst.MoveNext
Loop
Set ipd = Nothing
Set objPicture = Nothing
rst.Close
End If
Set rst = Nothing
Set imgX = Nothing
GoTo Done
SetImgListErr:
APGDebug (Err.Number & " " & Err.Description )
Done:
End Function


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3397
by: Bruce A. Wilkinson | last post by:
Greetings All I am currently attempting to pass an STDPicture object to the Picture property of a class module within a DLL. However, none of the usual methods seem to apply. The Microsoft Knowledge base has very little on the STDPicture object. Does anyone know if there is a build-in limitation that prevents you from passing this type of object? If so, is there a work around method I've missed? If anyone could point me toward some...
1
2142
by: bin liu via DotNetMonster.com | last post by:
I want to create a object of stdPicture in C#, so that I can render it to other object's prosperity. the VB6 code maybe as follow: Dim pic as Picture; pic = LoadPictureFile(strPath); then, how can I use C# to express the same idea? I want to know what is "Picture" means in C#, and how can I construct it! --
1
5314
by: Sagaert Johan | last post by:
How can i put the image in a stdole.StdPicture object in a Picturebox.Image ?
3
8057
by: Metallicore | last post by:
Does anyone know how to load a vb6 stdPicture (in an existing DLL) from vb.net? System.Drawing.Image is not the same thing as stdPicture in vb6.
0
1967
by: Mark | last post by:
We're authoring a VS 2005 app that includes several EXE's and DLL's and also uses a COM component (a customer requirement). The COM component provides a graphic image to be used by the .NET app; the graphic is supplied as a "StdPicture" (AKA, IPictureDisp). The only way I have found to convert this to a .NET Image is: Microsoft.VisualBasic.Compatibility.VB6.IPictureDispToImage Is that the only way to accomplish this conversion? How...
4
3216
by: Mark | last post by:
We're authoring a VS 2005 app that includes several EXE's and DLL's and also uses a COM component (a customer requirement). The COM component provides a graphic image to be used by the .NET app; the graphic is supplied as a "StdPicture" (AKA, IPictureDisp). How can I convert this to a .NET Image? A search of the object browser shows: protected static System.Drawing.Image GetPictureFromIPictureDisp(object picture)
0
1807
by: fyderniX | last post by:
Hey; I'm using the Document Imagine API from Office 2003. I need to get away from the proprietary MDI/TIFF formats it produces. It looked pretty simple, but it's giving me grief when I try to convert the IPictureDisp object it creates into an Image for use with .NET: -----begin source (C#)----- //Take page 1 MODI.Image page_1 = (MODI.Image) doc.Images;
5
4237
by: Dominic Vella | last post by:
Does anyone have any details on what the PictureData structure looks like? Thanks in advance. Dominic
1
7577
by: nikhilkajrekar | last post by:
i have picturedata and i want to save that to image file how i can do that i have this function but not working for all images Function FPictureDataToClipBoard(ctl As Variant) As Boolean ' Memory Vars Dim hGlobalMemory As Long Dim lpGlobalMemory As Long Dim hClipMemory As Long ' Cf_metafilepict structure
0
10138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9930
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.