3
votes

I am developing a proj in vb 6. what the problems is that when i load icons(extension .ico) it gives "Invalid Picture". I searched it out on all the forums but still lying in. Any help would greatly be appreciated.

Image1.picture = loadpicture(app.path & "\Abc.ico") 

But when convert the file to jpg from ico format :

image1.picture = loadpicture(app.path & "\Abc.jpg")

It is loaded to Image1.

i have also converted the icon file it to 24 bit from 32 bit but still is not working.

5
Please edit your question to provide the specifics. Posting it in a comment means people can't see it when they read your question. Thanks. Is Abc.ico a valid Windows icon? Not PNG, but old-style Windows icon - VB6 is old, and doesn't support alpha-blended or high-color icons; it expects old format, dull icons like in the Windows 95 days.Ken White
You actually said (in a previous comment) "when I change picture name"; you didn't say "When I use a different picture file". You have an invalid icon file. As I said, VB6 is old, and expects .ico files to be the old Win95 format, not the newer alpha-blended Vista/Win7 icons.Ken White
@KenWhite - I love your real world examples!logixologist
Once again, you have an invalid icon file. VB6 wants old-style, 32x32, 256 color Win95-type icons, and the one you're trying to load apparently isn't one. As we don't have a copy of the icon file to examine, it's pretty much impossible to explain anything else.Ken White

5 Answers

4
votes

Your icon is probably a 32bit icon- it just needs to be changed to 24bit in order for it to be supported in VB6. You can use a program like IcoFX to change the bit depth.

1
votes

You must create your icon file using a generator that actually saves it as an .ICO. You cant try to take a jpg or png and re-save it as an .ico file.

1
votes

In VB6 Icons (*.ICO) can only be used to be set as icons wherever applicable. You can use *.ico file for the application's main window.

But the image1.picture can't have an icon loaded with the loadpicture method.

0
votes

The best way to load pictures of almost any format I recommend you using FreeImage (http://freeimage.sourceforge.net/).

You need to copy FreeImage.dll to the Windows\System32 folder and then include their bas module into your VB6 project. Once you do that you can load an icon simply into your image:

Image1.Picture = LoadPictureEx(App.Path & "\Abc.ico")
0
votes

Once i got this error when the C: drive had zero bytes free. After cleaning some space the error gone.