[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Assign and image

Posted on 2005-05-13
Medium Priority
Last Modified: 2010-04-05
I am working with dialog boxes and am looking for a way to change an image within the dialog box by code to one from a resource file.

I have used LoadImage to load the image with no problem but cannot figure out how to assign it to the control in the dialog box (i have tried SendMessge, SendDlgItemMessage and others but they don't work)

Can anyone help?
Question by:GroundFloor
  • 4
  • 3
LVL 34

Expert Comment

ID: 13998378
what is the control?

some other?
 I am guessing that the dialog control already is showing an Image?

and what message do you use?
LVL 15

Expert Comment

ID: 13998643
If your trying to change the image for a message dialog, take a look at


Author Comment

ID: 13999044
its a CONTROL, SS_BITMAP with an ID of 188

I can add the graphic if i add the resource into the same dialog creation script but if i add the graphic as a resource and try to add it it is then i run into the problem of what command to use to assign the image to the control.
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

ID: 13999055
aslo, i looked through http://www.angelfire.com/hi5/delphizeus/dialogs.html and couldn't find anything about it.
LVL 34

Accepted Solution

Slick812 earned 400 total points
ID: 14000855
if you are using API then you better get use to constantly looking at and reading the Win32 Help, if you look at the Help for static controls you can see the messages that are just for STATIC controls, these messages include -

here is some code from the Help -

SendDlgItemMessage(hDlg,  /* dialog box window handle */
               IDI_ICON,              /* icon identifier          */
               STM_SETIMAGE,          /* message to send          */
               (WPARAM) IMAGE_ICON,   /* image type               */
               (LPARAM) aIcons[i++]); /* icon handle              */

in Pascal -

SendDlgItemMessage(hDlg, 188,  STM_SETIMAGE, IMAGE_BITMAP, hBitmap);

maybe this will work?

Author Comment

ID: 14002443
Thanks Slick812

I looked in the Win32 Help and on MSDN but didn't find anything about STM_IMAGE.

I am using your suggestion of SendDlgItemMessage but the image is not displaying - but i think that may be something i am doing wrong and am trying different ways to see if i can get it to work.

Maybe you should write a book about all of this - i would buy it because there is nothing of use out there.

LVL 34

Expert Comment

ID: 14003334
are you sure that your LoadImage is not returning Zero? You need a valid bitmap Handle, , , ,
there are only 5 parameters in the SendDlgItemMessage( ), have you checked all 5 to see if they are valid?

as to the MSDN Library, I could not beleive that you got nothing for a STM_SETIMAGE search so I went to the MSDN Library and did a search for -

and got more than 30 hits

the MSDN page for the STM_SETIMAGE in Win32 API is -


and it specifically lists the   SS_BITMAP  STATIC control style

anyway I meant that you read the whole section about Static controls, at -


you might read the overviews and stuff about messages and the others

the Win32 Help Files that came with delphi, may also be used, reading the stuff about controls like , , index

Button Controls

Static Controls

Scroll Bars



. . . . . . . . . .

can give you very helpful info for API

Author Comment

ID: 14003566
Yep, the problem was with no handle being returned - seems if i add in a # in front of the resource number it works.

What i did a search on was for SendDlgItemMessage on MSDN and got nothing more than what was in the Win32 help.

Again, thanks very much for the help and sorry to be such a pain in the a** :)

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Integration Management Part 2
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question