Invalid Picture In Visual basic 6

Tag: vb6 Author: q654651985 Date: 2013-06-04

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 change the file to jpg from ico format

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

It is loaded to Image1.

If you don't show us how you're loading the icon, there's not much we can do to help you determine what's wrong. Please edit your question and provide more information and be specific if you want to get help here. Thanks.
Image1.picture = loadpicture(app.path & "\Abc.ico")
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.
Well, if you tell it to open an icon, and then hand it a JPG, of course it fails. If you're blindfolded, and someone hands you something round and says "Here's an apple.", you're not going to be happy when you take a bite and it's actually an onion. If you have a JPG, give it a .jpg extension.
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.

Other Answer1

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.

comments:

Try this link: google.com/…
my dears i haven't changed the jpg,bmp,png or other files to ico.
I have just downloaded .ico files from web and want to place it in my design interface. But it gives err.
they need to be very simplified ico's for VB6
so i don't know from where i can get simplified ico's.Someone has told me in our Softhouse that it might be caused by using 32 bit ico's,change it to 24 bit. i did so but so far i m lying in.

Other Answer2

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.

comments:

How can an icon be loaded as a picture? Is there even a way?

Other Answer3

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")