Loading Image into Dialog

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Loading Image into Dialog

Post by kpassaur » Sat Jun 12, 2010 3:10 pm

I am having some difficulty loading images into a dialog as it does not always update them. Sometimes it works and sometimes I need to do it two or three times before it saves the path from file browse and inserts the image. That is issue one.

Issue two is that I wrote a script and then replaced the path I was using from c:\program files\program name to %ProgramFolder%

and I have a line that comes first and says
Let>ProgramFolder=c:\program files\program name
(actually it is read from the registry - but I checked it)

Everyting works fine except the images no longer display in the dialog. It used to with Ver 11 so I checked the help file and it says

Loads an image from file. Specify the filename of the picture to display (can be bitmap, jpeg, png, ico). Note that the image data is loaded statically into and stored in the dialog and while the file name is also stored for reference there is no dynamic link to that file.

Which does seem to be true as it no longer displays. I have not checked it on another machine where it is not present. The point of using %ProgramFolder% is that I can run it on Vista, XP etc with both 32 and 64 bit systems and it can still find the path.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sat Jun 12, 2010 5:00 pm

Once loaded it stores the bitmap data, NOT the file path. So it is NOT a link to the file on disk. If you WANT a link to a file on disk then you would need to load them dynamically at runtime. So you would need to use SetDialogProperty and set the LoadImage property to the filename of the image:

SetDialogProperty>Dialog1,MSImage1,LoadImage,c:\path\myimage.bmp

When adding the image at design time it is stored permanently (the data of the image, not the filename) into the dialog and you'll see something like this in the dialog block:

Picture.Data = {
07544269746D617........lots of lines like this

This image is then permanently part of the dialog and is not linked to any file - the image data itself is stored in the dialog.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts