ASD
ASD

Reputation: 1441

How to restore the images uploaded for imagelist control in VB 6.0

I have a VB 6.0 application which contains some images inside a imagelist control. I want to know where these images get stored in the system (because I want to use these images in another application and I don't have the images separately in the system).

So, the only way is to take the images from Visual Basic 6.0 project. Do we have anything like resource folder similar to .Net?

Upvotes: 2

Views: 5663

Answers (3)

Don
Don

Reputation: 1

' utility to save images from a VB6 imagelist - example ExtractVB6ImageListImages(ImageListModes,"ImageListModes")
Function ExtractVB6ImageListImages(myimagelist As ImageList, listname As String)
    Dim nCount As Integer
    Dim nIndex As Integer
    Dim sKey As String

    Dim temp As Image

    nCount = myimagelist.ListImages.count()
    For nIndex = 1 To nCount
        If nIndex < 10 Then
            SavePicture myimagelist.ListImages(nIndex).Picture, listname + "00" + Mid(Str(nIndex), 2) + ".bmp"
        ElseIf nIndex < 100 Then
            SavePicture myimagelist.ListImages(nIndex).Picture, listname + "0" + Mid(Str(nIndex), 2) + ".bmp"
        Else
            SavePicture myimagelist.ListImages(nIndex).Picture, listname + Mid(Str(nIndex), 2) + ".bmp"
        End If

    Next

End Function

Upvotes: 0

wqw
wqw

Reputation: 11991

  • Start an empty project.
  • Add reference (Ctrl+T) to Microsoft Windows Common Controls 5.0 or 6.0
  • Copy/Paste image list control to Form1
  • Rename image list control to ImageList1

Use this code

Dim lIdx As Long

For lIdx = 1 To ImageList1.ListImages.Count
    SavePicture ImageList1.ListImages(lIdx).Picture, "C:\TEMP\img" & lIdx & ".bmp"
Next

Upvotes: 6

xpda
xpda

Reputation: 15813

I ran across the same problem some time ago. I ended up writing a small function in the form with the imagelist that "manually" saved each image in the imagelist to disk.

Upvotes: 1

Related Questions