Results 1 to 4 of 4

Thread: What is the Diference?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2002
    Location
    Peru
    Posts
    21

    Question What is the Diference?

    What is the diference in this commands?

    AfxMessageBox("Test"); -----and

    MessageBox("Test");

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    The afx call is meant for use under MFC. It supports a help context as well.

    MessageBox will work for platform SDK development, as well as MFC. No help context.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    AfxMessageBox does a few things for you.
    First it selects a title for the message box (the application name or if that doesn't exist the exe file name). Then it chooses a default icon based on the buttons you specify if you haven't selected an icon.
    Then AfxMessageBox does the setup for the context help. It uses an MFC-internal mechanism for that.
    Finally AfxMessageBox calls the WinAPI MessageBox.

    Actually most of this is done by CWinApp::DoMessageBox, but this is hidden from the user.

    AfxMessageBox has an overload which takes an UINT instead of a string. This overload loads the string resource identified by the UINT parameter and then calls the string version passing the newly loaded string. Very useful for localization.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    MessageBox is a plain windows API function, included in user32.dll. You would use it in standard Win32 projects that do not require MFC.

    AfxMessageBox comes with MFC. I think by using it you add an extra "layer" of processing to your program.

    hope that helps
    VS.NET 2003

    Need to email me?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width