DOCERR: Do Not Use MB_NOFOCUS Flag with MessageBox Function

Last reviewed: July 23, 1997
Article ID: Q87341
3.10 WINDOWS kbtoolkbtoolg kbdocerr

The information in this article applies to:

  • Microsoft Windows Software Development Kit (SDK) for Windows version 3.1

In the Microsoft Windows graphical environment, an application can use the MessageBox function to create, display, and operate a message box window. The fourth parameter of the MessageBox function is fuStyle, which has the UINT data type.

The fuStyle parameter specifies the message box style; it can be a combination of the MB_* values, including MB_OK, MB_ICONHAND, MB_SYSTEMMODAL, and so on. These values are defined in the WINDOWS.H header file provided with the Microsoft Windows Software Development Kit (SDK).

WINDOWS.H defines MB_NOFOCUS, which is not listed in the SDK documentation (printed or electronic). In the book "Programming Windows 3" by Charles Petzold (Microsoft Press), page 440 states that when the MB_NOFOCUS flag is specified, Windows creates the message box but does not give it the focus. This statement is incorrect.

MB_NOFOCUS is not one of the standard MB_* values and it cannot be used in the fuStyle parameter. Although MB_NOFOCUS is used internally by Windows, it is not passed to or accepted from an application.


Additional reference words: 3.10 docerr
KBCategory: kbprg kbdocerr
KBSubcategory: UsrDlgs
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 23, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.