MessageBox Visual Studio Add-In

Environment: Visual Studio 6

How many times have you had to go through the same gyrations to create a message box? Is it the first argument or the
second that’s the title as opposed to the text. What are the exact constants again for an OK button and a Cancel button?
What are the valid return values? Well no more! This very useful add-in saves you from having to remember that from
now on!

Using this add-in, you can visually set any of the following:

  • Icon type
  • Buttons
  • Caption (notice the built-in values provided for you!)
  • Text message
  • Modality
  • Default button
  • You can even specify the conditional expression!

When you’re finished selecting your settings, simply click the “Copy to Clipboard and Close” button. You’ll be
returned to your previous source window. Just paste the code from the clipboard and you’re done!

Example

Using the settings shown in the figure above, the add-in produced the following!

if(MessageBox(_T("This is an Error Message !!!\nReturn ?"),
              _T("Error"),
               MB_ICONHAND|MB_YESNO|MB_DEFBUTTON1)
               == IDNO)
{
}

Installing the Add-In

To install the add-in, follow these steps:

  1. Download the DLL (remember to unzip the file) or download the source and build the DLL
  2. Copy the DLL to the Visual Studio AddIn folder (the default location is the
  3. c:\program files\microsoft visual studio\Common\MSDev98\AddIns’ folder).

  4. Click the Tools->Customize menu option
  5. Click the Add-ins and Macro Files tab
  6. Check the “MsgBox Developer Studio Add-In” add-in
  7. Now you can assign it to a key or place it on a toolbar as you like

Downloads

Download MsgBox Add-In – 17 Kb

Download source – 47 Kb

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read