Using the IgnoreMessageBox Fix

Applies To: Windows 7, Windows Vista

This section includes information about using the IgnoreMessageBox compatibility fix, including the issue details, the intercepted APIs, the available command-line options and usage, and the recommended fix for a permanent solution.

IgnoreMessageBox

IgnoreMessageBox fixes an issue whereby a message box appears with debugging or extraneous content, if the application is run on a non-supported operating system.

This compatibility fix intercepts the MessageBox* APIs and then inspects them for the message text that is configured at the command line. If a match is found, this fix returns an MB_OK value instead of displaying the message box. For example, if the application includes the following code:

int MessageBox( HWND hWnd,
LPCTSTR lpText,
LPCTSTR lpCaption,
UINT uType
);

Then the compatibility fix will look for the lpText and lpCaption lines for matching information that maps to items that would be included in the message box.

Important

You must use wildcard characters to correctly match the text. For example, if you were looking for "Windows", it would not find a Windows Media Player Error dialog box; however, if you used "Windows*", it would locate the Windows Media Player Error dialog box.

Investigating the Issue

The IgnoreMessageBox compatibility fix should be considered as a possible resolution if you receive a message box that never appeared on a previous operating system, if the dialog box is not helpful, and if the application can continue to function properly after the message box is closed.

Intercepted APIs

The following APIs are intercepted by the IgnoreMessageBox compatibility fix.

  • MessageBoxA

  • MessageBoxW

  • MessageBoxExA

  • MessageBoxExW

Command-Line Options

The IgnoreMessageBox compatibility fix uses the following syntax to specify the matching criteria.

MessageBoxText1,MessageBoxCaption1;MessageBoxText2,MessageBoxCaption2;...

With this syntax, you can use any text as your matching criteria for the message box and caption text. You can leave the text or caption parameter blank, so that the fix will match any text or caption text. Alternatively,you can include wildcard characters, such as *, which will match zero or more characters in this position, or ?, which will match 1 or more characters in this position. To properly support the parsing of your command-line text, you should always escape the following characters by using a backslash (\) character.

  • ?

  • *

  • ,

  • ;

For example, Windows*\

Fixing Your Code

Applications should be modified so that they do not display a message box in response to the events that are triggering the message box on the unsupported operating system.

See Also

Concepts

Windows Vista and Windows 7 Operating Systems