Display custom icon on message box

C

Charles Tam

Is it possible to replace the standard icon with a custom icon for a msgbox?
If not, what are my alternative?
 
W

Wayne Morgan

By replace the custom icon I assume you mean all of the options, such as
vbExclamation and vbCritical. If so, no, but there is a work around. You
would need to create your own form. Design it to look like a MsgBox by
setting Control Box, Min Button, Max Button, Record Selectors, etc to No in
the form's Properties. When you open the form, use the acDialog window mode
argument. This will cause the calling code to pause just as it does for a
message box. The code will continue when you close or hide the form. To
return a value from the form, place a hidden textbox on the calling form and
have the dialog form place the return value in that textbox or have a hidden
textbox on the dialog form, place the value in it, and hide the form
(Visible = False) instead of closing it. Your calling code can then retrieve
the value form the dialog form then close it after the retrieval.
 
6

'69 Camaro

Hi, Charles.
Is it possible to replace the standard icon with a custom icon for a msgbox?

Yes. You could use the Windows API functions to load your own custom icons
into the message box, but this is quite a task. Most people take the
alternative, a custom dialog form resembling the System MsgBox. You may want
to take a look at Arvin Meyer's tool for creating custom message boxes:

http://www.datastrat.com/DataStrat2.html (see MsgBox2K download)

However, if you'd like to investigate the Windows API functions path, please
see the following Web pages for some ideas:

http://msdn.microsoft.com/library/d...nce/dialogboxfunctions/messageboxindirect.asp

http://msdn.microsoft.com/library/d...s/hookreference/hookfunctions/messageproc.asp

http://msdn.microsoft.com/library/d...urcereference/resourcefunctions/loadimage.asp

http://msdn.microsoft.com/library/d...ereference/resourcemacros/makeintresource.asp

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. Remember that questions
answered the quickest are often from those who have a history of rewarding
the contributors who have taken the time to answer questions correctly.
 
Top