The problem, of course, is that VB's LoadPicture (and the underlying API that it wraps) predate the png file format, and so cannot load them.
So we need to find a newer library that does understand png and can also returned such an image as an OLE picture (which is what VB understands).
Fortunately, Microsoft have provided such a library called the Windows Image Aquisition library (or WIA) which is pretty easy to use (and compared tio the normal LoadPicture adds support for both TIF and PNG file formats, but does not directly support ICO or CUR file formats). Here's a basic replacement for the normal VB LoadPicture function that should achieve what you are asking for:
Code:
[blue]Public Function NewLoadPicture(strPath As String) As StdPicture
With CreateObject("WIA.ImageFile")
.LoadFile (strPath)
Set NewLoadPicture = .FileData.Picture
End With
End Function[/blue]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.