Can I change MsgBox Constants Graphics in VB5?

I am using the MsgBox function in VB5 Enterprise and I would like to use custom graphics for the icons:

vbCritical        16    Display Critical Message icon.
vbQuestion        32    Display Warning Query icon.
vbExclamation     48    Display Warning Message icon.
vbInformation     64    Display Information Message icon.

Is it posssible to change these graphics?

Ideally I would create my own form but I'm not too sure how to pass parameters to a form.
How do you pass parameters to a form in VB?
If anyone can answer either of these questions, preferably the last as I would like to use
custom fonts and layouts as well, then I'll give top marks.

Cheers.
imajdnAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anita030598Commented:
For your second question:

There is nothing like passing parameters to a form. However, you can have public Properties and/or Mehods in a form. And you can set those Properties and/or call the Methods from some other modules any time you want.  Think about it, it may help you.
0
jf26028Commented:
You can pass parameters to a subroutine and from there, based on the parameters, load the form.
0
imajdnAuthor Commented:
Are you talking about passing parameters to the Form_Load method?
How?

Rather than having me guess can you give me an example of the calling and
called methods? I'd rather get a example working solution than have to work it
out myself using a few tips.

Cheers.

0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

jf26028Commented:
Sorry I was not clear, but I did not have time to put an example.  I dont think that you can actually change the msgbox.  This is just a quick example of passing arguments to a subroutine and then loading a form with that subroutine inplace of the msgbox.  All you have to do, is make the form look like a msgbox.

Sub Command1_Click()

  Dim MsgBoxType as Integer

  statements...
  statements...

  If ErrorOrSomeReasonForAMsgBox Then
     If ErrorOrSomeReasonForAMsgBox = "Critical Message" Then
        Call DisplayFormLikeAMsgBox(1)
     End If
     If ErrorOrSomeReasonForAMsgBox = "Warning Query" Then
        Call DisplayFormLikeAMsgBox(2)
     End if
     ...Continue for the rest of the msgbox types
End Sub

Private Sub DisplayFormLikeAMsgBox(TypeOfIcon as Integer)
   If TypeOfIcon = 1 Then
      Form2.Picture1.Picture = "CriticalIcon"
      Form2.Load vbModal, Me
   end if
   If TypeOfIcon = 2 then
      Form2.Picture1.Picture = "WarningIcon"
      Form2.Load vbModal, Me
   end if
.And so on for the rest of the possible calls.

End Sub



This might not be what you were looking for in the first place, but it is a work-around the fact that you cant change the icon in the msgbox.  You could make the above code better with Select Case statements and things like that, but it is just an example.
0
imajdnAuthor Commented:
I'm sorry to be blunt but what you have given me is a pile of tosh.

You do not load a form using:

         Form2.Load vbModal, Me

you declare the form, set the form, load the form, then show the form: e.g.

    Dim f2 As  Form2

    Set f2 = New  Form2
    Load f2
    f2.Show vbModal

AND what you have given me doesn't show any picture at all.

Using:

   Set f2.Picture1.Picture = LoadPicture(CurDir & "test.bmp")

just does not show the picture. I have tried the statement before and
after the Load Statement.
It is just an idea but why don't you try out a solution then give the results of
that solution. I am spending time trying to adapt what you give me into a
working solution and the whole point of Experts Exchange is that YOU
spend the time working out the solution and I give you the points.
Sorry but giving me what appears to be pseudo code isn't good enough.
0
jf26028Commented:
Sorry, I didnt realize who I was dealing with.  I assumed that you would be able to use the code as an example and figure out what you needed to do.  I will write a sample and post it on the web so that you can just cut and paste my code into your project.  Sorry for the trouble.  Ill post the answer when I get a chance.
0
jf26028Commented:
Here is the answer that I was talking about:

What you need:
Form1 - Just a form that has three command buttons on it, one for each type of msgbox that you want to call.  In this example, there are only three, Critical, Warning, and Information respectively.

Form2 - A form with three pictureboxes on it.  Picture1, Picture2, and Picture3, which represent the Critical, Warning, and Information icons.  The picture boxes 2 and 3 are invisible on the form, but still hold the pictures of the Warning and Information icons.  Picture1 is in the location on the form
where you want the icon to be located.  There must be a picturebox for each of the icons that you want to show.  All are hidden except for #1.

Use this code to make the form that looks like a msgbox appear.  This code is in form1.

'example of a Critical Event
Private Sub Command1_Click()

    Call Msg(1) 'the 1 representes the type of icon in the
                'msgbox.  in this example, it is Critical

End Sub


Private Sub Command2_Click()

    Call Msg(2) 'the 2 representes the type of icon in the
                'msgbox.  in this example, it is Warning
   
End Sub


Private Sub Command3_Click()

    Call Msg(3) 'the 3 representes the type of icon in the
                'msgbox.  in this example, it is Information
   
End Sub




'this is the code that changes form2 to look the way
'that you want(critical, warning, or information)

Sub Msg(Kind As Integer)

    If Kind = 1 Then  'the form should look like a critical msgbox
        'use the icon that is already in picture1 (the critical icon)
        'and show the form
       
        Form2.Show vbModal, Me
    End If
    If Kind = 2 Then  'the form should look like a Warning msgbox
        'the picture is changed from picture1 to picture2(the warning icon)
        Form2.Picture1.Picture = Form2.Picture2.Picture
        Form2.Show vbModal, Me
    End If
    If Kind = 3 Then
'       ...
        Form2.Picture1.Picture = Form2.Picture3.Picture
        Form2.Show vbModal, Me
    End If

End Sub

This project is available at http://www.swt.edu/~jf26028/da.zip.
You may have problems if your paths to your icons in form2 are not the same as mine, but you can just insert your own.  Let me know if you still dont understand.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
imajdnAuthor Commented:
Thank you jf26028.
That is more like what I was expecting. I don't mind giving out full marks
if the answer is good. It's just that I don't have time to second guess someones
pseudo code.

Cheers again.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.