Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Invalid Picture When Adding Icon


Hey,

I am trying to add an icon to my form and each time I try it I get a error saying "Invalid Picture". The Icon is a valid .ico file (Not just renamed to .ico or anything like that).

Please help!

Thanks,

Tom




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Icon = Invalid Picture?
Hey,

I have a 64x64 .ico file. It was saved specifically as a .ico file but VB tells me "Invalid picture". Why is that?

Thanks,
-Matt

Invalid Icon Picture??
I was making a form that I wanted to have an icon different then the default VB 6.0 icon. I have a valid .ico picture that a friend made and I tried to use it and it said it was an "invalid picture". Is there a proper way of setting an icon for a form that I don't know about?

Invalid Picture In Icon
Hi to all:

I had try to insert a icon in a form made by articons format 48*48,and I got a message:"Invalid Picture".

Something wrong with the format of the icon,or something limitation by VB??


Thanks

Invalid Picture When Assigning An Icon
hi, i tried to assign an icon in my form... at first i was able to load some "flat icons" those with 2 colors or less and it worked but now i want assign better looking icons to my app and i get an error message that says: invalid picture... why? it's still the same .ico file! is it because of the size format of the color?

Adding A Picture/icon In A Toolbar Problem
I'm trying to add an icon to my toolbar. I already inserted pictures in the imagelist. But when I try to select the Imagelist1 object in the ImageList property of the toolbar I always got <none> after clicking apply. anyone who knows why? please help

Adding Supoort For 32bit Icon As My Forms Icon..?
Hello,

Ive had a little search around and all i get is a result from vbaccelerator.

It shows support for alpha channels and 32bit icons etc.. but only for form controls and not the form itself.

Is it possible to place a 32 bit icon as my forms icon ..? so it shows smooth with alpha blending in my icon tray and task bar too...??

Icon: Invalid Property Value?
For a long time I've been wanting to get rid of the annoying VB default icon that always appears on my programs and as the default icon the finished .exe. When I hit the "..." on the icon property of the only form in the program, and choose my 32x32 icon, after I click the 'open' button it refuses the file saying that its an 'invalid property value'. I tried 24-bit, 256 colors, and 16 colors, but the same thing happens. So how am I supposed to get the icon on both the upper-left and the finished .exe?

Invalid Picture
is there a cleaner way to determine if a picture is valid or not other than using the Err object (meaning I want to prevent the Err from ever happening)

I guess I would want a ValidPicture() function that returns true or false or something like that.

Also - it can't just check for the file's existence because some pictures that are loaded are incomplete and give the invalid picture error 481 when i use the LoadPicture() function.

Invalid Picture
Hello reader,

I made a vb application and for the finishing touch I found a really nice icon. But when I want to use this item in the icon property I get the error message "Invalid picture". The icon has got the .ico extension, when I use a picture with a bmp or jpg extension I get the same message. I use vb6 and try to use xp icons, maybee this is the problem??

Thanx

Invalid Picture
I suppose to put a picture in my form but it give a Invalid Picture error.

Why is that?

Invalid Picture
Hi

I am developing one app which needs inbuild FTP support, so i am now developing an FTP Explorer. Everything is done except displaying file's default icons ( i.e. icons displayed in Windows Explorer). I am using the following code to extract the file's default icon


VB Code:
Option Explicit 'For looking at registry keys 'To: Open key ready to look at Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long 'To: Look at key Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As Any, lpcbData As Long) As Long 'To: Close the key when it's finished with Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long  Private Const HKEY_CLASSES_ROOT = &H80000000 Private Const KEY_READ = &H20019 'To allow us to READ the registry keys  'For Drawing the icon 'To: Retrieve the icon from the .EXE, .DLL or .ICO Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long   'To: Draw the icon into our picture box  Private Declare Function DrawIcon Lib "user32.dll" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal hIcon As Long) As Long 'To: Clean up after our selves (destroy the icon that "ExtractIcon" created) Private Declare Function DestroyIcon Lib "user32.dll" (ByVal hIcon As Long) As Long  'For Finding the System folder Private Declare Function GetSystemDirectory Lib "kernel32.dll" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long  Private Sub GetDefaultIcon(FileName As String, Picture_hDC As Long )     Dim TempFileName As String 'Never manipulate an input unless it doubles as an output     Dim lngError As Long 'For receiving error numbers     Dim lngRegKeyHandle As Long 'Stores the "handle" of the registry key that is currently open     Dim strProgramName As String 'Stores the contents of the first registry key     Dim strDefaultIcon As String 'Stores the contents of the second registry key       Dim lngStringLength As Long 'Sets / Returns the length of the output string       Dim lngIconNumber As Long 'Stores the icon number within a file      Dim lngIcon As Long 'Stores the "Icon Handle" for the default icon       Dim intN As Integer 'For any temporary numbers       TempFileName = Right(FileName, Len(FileName) - InStrRev(FileName, ".") + 1)       If LCase(TempFileName) = ".exe" Then           strDefaultIcon = Space(260)          lngStringLength = GetSystemDirectory(strDefaultIcon, 260)          strDefaultIcon = Left(strDefaultIcon, lngStringLength) & "SHELL32.DLL"          lngIconNumber = 2          GoTo Draw_Icon      End If        lngError = RegOpenKey(HKEY_CLASSES_ROOT, TempFileName, lngRegKeyHandle)      If lngError Then GoTo No_Icon 'we do not even have a valid extension so lets NOT try to find an icon!       lngStringLength = 260      strProgramName = Space$(260) 'Make space for the incoming string       'Get the key value:       lngError = RegQueryValueEx(lngRegKeyHandle, vbNullString, 0, 0, strProgramName, lngStringLength)      If lngError Then 'if there's an error then BIG TROUBLE so lets use the normal "windows" icon           lngError = RegCloseKey(lngRegKeyHandle) 'the world may be about to end (or just an error) but we'll clean up anyway           GoTo No_Icon      End If       lngError = RegCloseKey(lngRegKeyHandle) 'if this generates an error then we can't do anything about it anyway     strProgramName = Left(strProgramName, lngStringLength - 1) 'Cut the name down to size       'Use the value of the last key in the name of the next one (strProgramName)       lngError = RegOpenKey(HKEY_CLASSES_ROOT, strProgramName & "DefaultIcon", lngRegKeyHandle)      If lngError Then GoTo No_Icon 'there is no icon for this extension so lets NOT try to load what doesn't exist!       'The rest is just the same as before       lngStringLength = 260      strDefaultIcon = Space$(260)      lngError = RegQueryValueEx(lngRegKeyHandle, vbNullString, 0, 0, strDefaultIcon, lngStringLength)      If lngError Then           lngError = RegCloseKey(lngRegKeyHandle)          GoTo No_Icon      End If       lngError = RegCloseKey(lngRegKeyHandle)      strDefaultIcon = Trim$(Left(strDefaultIcon, lngStringLength - 1))       intN = InStrRev(strDefaultIcon, ",") 'Find the commer       If intN < 1 Then GoTo No_Icon 'We MUST have an icon number and it will be after the ",": NO COMMA NO DEFAULT ICON      lngIconNumber = Trim$(Right(strDefaultIcon, Len(strDefaultIcon) - intN)) 'What number is after the comma       strDefaultIcon = Trim$(Left(strDefaultIcon, intN - 1)) 'We only want what's before the comma in the file name    Draw_Icon:      lngIcon = ExtractIcon(App.hInstance, strDefaultIcon, lngIconNumber) 'Extract the Icon       If lngIcon = 1 Or lngIcon = 0 Then GoTo No_Icon 'if 1 or 0 then after all that the Icon Could not be retrieved        lngError = DrawIcon(Picture_hDC, 0, 0, lngIcon) 'Draw the icon in the box      'If that was unsucessful then we can't do anything about it now!       lngError = DestroyIcon(lngIcon)      'Again we can't correct any errors now       Exit Sub No_Icon:      'No icon could be found so we use the normal windows icon      'This icon is held in shell32.dll in the system directory, Icon 0       strDefaultIcon = Space(260)      lngStringLength = GetSystemDirectory(strDefaultIcon, 260)      strDefaultIcon = Left(strDefaultIcon, lngStringLength) & "SHELL32.DLL"      lngIconNumber = 0      GoTo Draw_Icon End Sub


Here’s how to use this subroutine (remember that picture box's “AutoRedraw” property is set to True!:


This subroutine displays icon in the picture box but when i try to add this icon in the Imagelist control it gives the error 'Invalid Picture' ( I am using Treeview & Listview to display folders and files so i am trying add icons to imagelist)



Please help

Invalid Picture...?
I have a little vb program that uses the ImgEdit control. Every once in a while the program will load and display 'Invalid Picture' and bomb out. Any idea what causes this and how to fix it?

Thanks!

Invalid Picture
I get an error message "invalid picture" when I try to insert an icon on
a form or a picture in a picture box
--
Chilangisha B Changwe
email@removed

--
http://www.fastmail.fm - IMAP accessible web-mail

Invalid Picture
I'm using this code to create an image file from the data in SQL Server:
Dim RS As ADODB.Recordset
Dim mstream As ADODB.Stream
Set RS = New ADODB.Recordset
RS.Open "Select HighLogo from CompanyData WHere CompanyID = " & lngCompanyID, objConn, adOpenKeyset, adLockOptimistic

Set mstream = New ADODB.Stream
mstream.Type = adTypeBinary
mstream.Open
mstream.Write RS.Fields("HighLogo").Value

mstream.SaveToFile "c:publogo.bmp", adSaveCreateOverWrite
Picture1.Picture=LoadPicture("c:publogo.bmp")
I get an error "Invalid Picture"

File is created, but I cannot open it with Paint or Photoshop.
I link to the table in SQL Server from Access (I don't know any other way to see the picture in SQL Server field) and I can see the image there. So, SQL Server contains an image.
I tried to insert different format images into the table (BMP, JPG, GIF). All of them I can see via Access.
But when I retrieve the image and save as a disk file (tried with different extentions too), the file cannot be opened.

What's wrong?
Thank you

[Rizzolved] Assigning Imagelist Icon To Listview Item - Invalid Key?
The listview has an imagelist assigned to it's smallicon property. I load the listview with an icon of a folder. OK great. Now I need to change said icon if a condition is met.

I assign the first image by index:

oListview.ListItems.Add , oTable.Name, oTable.Name, , iIcon ' iIcon=5

Now when I go to change it, I tried:

Set oLVItem = lvSprocs.SelectedItem
oLVItem.SmallIcon = imgListviews.ListImages(5)

and

Set oLVItem = lvSprocs.SelectedItem
oLVItem.SmallIcon = imgListviews.ListImages("Green_Flag")

And with both, I get error 35603 - Invalid Key

I don't see how this should be an issue... "Green_Flag" is indeed the Key, and 5 is the index.

Anyone?

___________________________
Dave Applegate
Microsoft VB MVP, ACE [FAQs]
My friend has a trophy wife, but apparently she wasn't in first place.

Edited by - Metallisoft on 10/12/2006 3:53:09 PM

Invalid Picture - Error 481
Hi,

I'm trying to print a picture with two charts in it.
But when I try to print the picture I get and error: invalid picture error 481
I can't seem to find an answer in the forum
I have AutoRedraw set to true

Her's my code:
Private Sub cmdPreview_Click()
Dim obj As Object
Set obj = Printer

obj.Orientation = vbPRORLandscape

obj.PaintPicture Me.pctChart.Picture, pctChart.Left, pctChart.Top
obj.EndDoc

End SubI'm I doing something wrong?
Is there property settings to change?

Thanks in Advance

Invalid Picture With ImageBox
I have a .jpg file that cannot be loaded with the ImageBox Control in VB (I get a "Invalid Picture" error). The file loads fine in MSPaint. If i open the .jpg file in MSPaint and save it again as Blah.jpg, the ImageBox will now let me load it in VB.

Is there a way to fix this without having to open it in MSPaint and saving it again as a .jpg file?

The only thing I think is happening is VB6.0 is old and this type of .jpg file is newer and it's not supported. Is there any way around this?

ImageList ... Invalid Picture!!!!!
How come i get the Error... Invalid Picture, when adding an Image to the Image List??? I tried everything

Run Time Error 481- Invalid Picture
Hello All,

Our Netowrk admin denied access to the C: drive and since then the users get run time error 481- invalid picture while running a VB applications. Any ideas on how to resolve this. Our Network admin is adamant on not giving Access to the servers C: drive

Picture(Icon) -&gt; Picture(Bitmap) How?
How do I convert a Picture object containing an Icon (from a file) to a Picture object containg a Bitmap with a certain color (pink!) for the transparent portions of the icon?

I have gotten to the point where I have a HBITMAP but how do I create a Picture object that encapsulates this handle?

Thanks.

Picture Box Object Returns An Invalid Point Value
Hi!
I need a help about a picture box object. The object is parameterized as shown below (paste & copy from imediate window).

Although, returns the call below -1:
Picspec.Point(test, 10)
for test = -56,01186

The object returns for any coordinates the same value: -1.

Please, help!
Thanks in advance.



?Picspec.ScaleLeft
-100
?Picspec.ScaleTop
20
?Picspec.ScaleHeight
-20
?Picspec.ScaleWidth
200
?Picspec.Point(test, 10)
-1
?test
-56,01186

Invalid Picture When Image Not Selected In File List Box
When I click through the directory and file list boxes and find an image, it displays in an imagebox I have setup.

But if I click anything other than an image it comes up the error 'Invalid picture' how can I put in a message box saying 'not an image' instead of this VB error?

My code is: -


Code:
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

Private Sub File1_Click()
Image1.Picture = LoadPicture(File1.Path & "" & File1.FileName)
End Sub

Adding An Icon
im a begginer at using VB and i'm trying to add an icon to the .exe i made. i tried making one in paint thats 32 X 32 pixels, since thats what i'm told its supposed to be. but when ever i try to add it under the icon property for the form it always gives an error message. but when i download icons and add them they work. do i need a special program to make them or am i doing something wrong? Thanks

Adding An Icon
Hello - bit of a noob question - I have an icon in my project directory. How do I make this the project icon instead of the default one (The end result being the executable button is my icon)?

Cheers,
Scary

Adding An Icon In VB 6
Does anyone know how to add your own icon to your executable once you make the EXE file? When I click the Make...Exe and go to options, there is only the generic icon available in the drop down, with nowhere to browse to a .ico file. Any ideas?

Adding A Desktop Icon...
Hello All,

Can anyone let me know how to add a desktop icon in code at the end of the setup??

Thanks In Advance,
->Noah

Adding Icon To Application
I would like to add an icon for my application but am not sure how to do this. Any ideas?

Adding An Icon To Desktop
i want to add a brief bit of code to a cd so that a user can insert the CD and then start the code with START> RUN command (e.g. D:iconsetup.exe) and have the code place an icon on the desktop that has a Word file (e.g., D:letter.doc) on the cd as its target.

Thanks.

Adding Customised Icon
Hi,

I am new to VB. I ahve completed a project and created a setup file using the package and deployment wizard. I would like to know how to add a customised icon (I have created a small jpeg image) which will be displayed in thr start menu once the application is installed. As of now the defalut VB icon is displayed.

Thanks,
Harshad

Adding An Icon To MS Outlook
How do I add an icon and menu item to MS Outlook from my VB program (or Installshield) so that I can run my program from there just by clicking on them?

Adding Icon To A Listbox
How do i add icon (*.bmp,ico,etc) to a Listbox

Adding An Icon To Control
I created an enhanced treeview and would like to give it an icon. Under the Make Tab of Properties there is the Icon drop down but it only shows frmAbout. The icon I created is in the same directory as the rest of the control objects. The icon is 16 X 16. While I was searching for other info I remember seeing something about this subject on one of the web sites but I can't replay the same search.

Any idea on how to add the Icon?


Thanks,

Scott
The worst thing about wearing glasses is them being on your face.
Nothing is impossible, it just looks that way.

Adding An Icon To Taskbar
Please help me more.

I can not use the function Shell_NotifyIcon well, especially the type NOTIFYICONDATA.
I can declare the above function and type, but I don't know how to use them in my project.
I've never used an API before

Thanks

Adding Icon To Form
How can I add an icon to the top left corner of a form. I have a *.ico file, but when I try to add it in the property 'Picture', I always get the error message 'Invalid property value'. Using Form.Icon = "*.ico" directly in code works, but then I always have to include the icon file in the apps directory.

thanx for your help,

ds

Picture Box To Icon
I am working on a program that i would like to have a dynamic systray icon.
i have the systray part working i can make the image in a picturebox. the only thing i cant seem to do is out put the file to a .ico file. I looked at planet source code and found an icon editor but was unable to understand the code at all.

can any one point me to a small guide or some good info?

Thank you
GeeKman

Icon - Picture
Hi

I would like to know how i can put a picture as the icon of a compiled program.
Ive heard that i have to put a picture in the "Icon" properties menu (.ico) in the form that the program starts off with.
Is this the way to go about the problem? If so how do i do it...cause i tried inserting a picture that i created in Paint , by saving it as a 16 colour file and it still doesnt work.

Thanks for your help!

Icon - Picture
Hi

I would like to know how i can put a picture as the icon of a compiled program.
Ive heard that i have to put a picture in the "Icon" properties menu (.ico) in the form that the program starts off with.
Is this the way to go about the problem? If so how do i do it...cause i tried inserting a picture that i created in Paint , by saving it as a 16 colour file and it still doesnt work.

Thanks for your help!

Icon/Picture
In the Form at the top, where you are suppose to have a image, how can I change this image to my own custom image?-thanks

Adding An Excel Toolbar Icon.
Hello! Thanks for having a look at this post!

I had a quick question on adding an icon to an excel toolbar.
My question is: Is it possible to add an icon to 1 sheets toolbar in excel and have others be able to use the icon added to the toolbar.

For example, all my users have excel already installed. They all access 1 excel sheet over the network to get information. (yes i know access would be better but i have no choice there). The problem is i cannot have the users reinstall excel. I would need to find a way to have the excel toolbar icon show up despite not reinstalled excel. Is there a way to code it into the sheet. Or have some lil program run when the sheet is opened to install it?

I hope that all makes sense, essentially i just would like to be able to add a toolbar icon in excel so that all users can see it and use it, while not having to reinstall excel, or having the user have to configured anything to see it.

Any suggestions or comments would be very much appreciated!
Im not sure if this is possible btw.

Thanks in advance for reading this, and for any suggestions or comments given!

Adding Icon To Resource File....
HI

Im trying to add a icon to my resource file, but a get the message: "Invalid Icon File". Why? I used a Icon Extractor and extracted the Internet Explorer Icon and saved it as .ICO. Itried to Assign my shortcuts on my desk and I could use the icon file then but not when i tried to insert it to my resource file.

//Andi

Adding Icon To Command Button
Hi,

I'm trying to make some toolbar buttons using command buttons. I have some icons for the common toolbar buttons you get in office but i need to add them to the face of the command button - can anyone help out how i do this?

Simon.

Adding Notify Icon In Systray
I wanted my application to run but hide the form when i close it without ending the application Example form1.hide or me.Hide.

I need to add the icon of my application in systray (beside clock at right bottom corner) so that if user double clicks on it it will make my form1 visible again.

How can I get this done using VB6?

Urgent please thanks in advance

Adding Icon To System Tray
Now before you get all mad at me I have searched the entire forum and I found multiple codes. However none of them worked for me (im a VB newbie). I get a debugging error or something can anybody help? I need like a step through step help thing because I'm really really slow.

Adding Icon's At Higher Resolution
As far as I know VB only supports icons at 16bit correct? Is there anyway to add icons to an imagelist or put an icon in the form's upper left corner that is lets say, 256color or higher?
- Gabe

Adding Options To Titlebar Icon
If you left-click the little icon in the upper-left corner in most any windows program, there's that drop down menu with 'restore', 'size', 'move', 'close', etc.

What I want to do is have a form and when the user clicks on that little icon, there is a selection named 'Settings...' or whatever. This is an effort to keep the height/width of the form as small as possible.

Anyone implement something like this before?
/Olaf

Adding Icon To Control Panel
Does anyone know how I can add my app configuration tool as an icon in the Windows Control Panel?

Thanks

Adding A Delete Icon Into A Program
I want to add a delete icon to my program.Does anyone know of a website where I can download?

Adding Icon/bitmap To Submenu For A DLL
here's my dilemma..

How can I add a bitmap/icon to a submenu when the picture in a resource file.

Code:
'Get the menuhandle of your ap'Get the menuhandle of your app
hMenu& = GetMenu(Form1.hwnd)

'Get the handle of the first submenu (Hello)
hSubMenu& = GetSubMenu(hMenu&, 0)

'Get the menuId of the first entry (Bitmap)
hID& = GetMenuItemID(hSubMenu&, 0)

'Add the bitmap

Dim pict As StdPicture
Set pict = New Picture
Set pict = LoadResPicture(101, vbResBitmap)

SetMenuItemBitmaps hMenu&, hID&, MF_BITMAP, pict, pict


the above doesnt work..
thats what i've been working with. the funny thing is that is I add a form and load a picturebox with the pict variable... it'll work but I dont want a form in the project.

Code:

'Get the menuhandle of your ap'Get the menuhandle of your app
hMenu& = GetMenu(Form1.hwnd)

'Get the handle of the first submenu (Hello)
hSubMenu& = GetSubMenu(hMenu&, 0)

'Get the menuId of the first entry (Bitmap)
hID& = GetMenuItemID(hSubMenu&, 0)

'Add the bitmap

Dim pict As StdPicture
Set pict = New Picture
Set pict = LoadResPicture(101, vbResBitmap)
PictureBox.Picture = pict

SetMenuItemBitmaps hMenu&, hID&, MF_BITMAP, pict, pict


the above works...


I would apreciate any help.
Please help me...

Adding Icon To Toolbar Submenus
Hi all,
the question is:
how can I add an icon to toolbar subitems?

Thanks for all

Spavi

Copyright © 2005-08 www.BigResource.com, All rights reserved