Avatar of Dale Fye
Dale Fye
Flag for United States of America asked on

LoadPicture error with icon files

I'm completing an Access add-in which provides a visual interface for creating shortcut menus.

I am using the LoadPicture method to load image files into the Picture property of shortcut menu controls and this works great for jpg, bmp, and gif files, but not with icon files.  Every question I've looked at on all of the various on-line forums indicates that icon files in 16x16 or 32x32 are acceptable with True Colors or 256 color attributes, but every icon file I try to upload fails and raises an undocumented error (#-2140724809).
Microsoft AccessMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Dale Fye

8/22/2022 - Mon
Nick67

For giggles.
Rename the .ico file to .bmp or to .jpg.
Will it load?
Image support has varied greatly over the years with Access.
Go far enough back and only .bmp was usuable.
Sometimes, without the old Office Picture Manager installed, that was even the case in A2003.

I haven't tried loading an icon file with WIA yet.
It certainly can get done via WinAPI.
Have you tried the simple stuff first?
Nick67

What you may be hitting too is an .ico file with multiple sizes rolled in.
Those may not play nice with Access
http://icoconvert.com/Multi_Image_to_one_icon/
ASKER CERTIFIED SOLUTION
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Dale Fye

ASKER
Still looking into this.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Martin Liss

I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
Dale Fye

ASKER
Thanks for the help on this, Joe.