DOCUMENT:Q173638 11-SEP-1997 [vbwin] TITLE :BUG: What's This Button Disappears from MDI Child Forms PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0 OPER/SYS:WINDOWS KEYWORDS:vb5all VBKBObj VBKBVB ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Control Creation, Learning, Professional, and Enterprise Editions for Windows, version 5.0 --------------------------------------------------------------------- SYMPTOMS ======== Setting both the WhatsThisButton property and the WhatsThisHelp property of an MDI child form to True does not enable the What's This button to appear in the title bar of the form. RESOLUTION ========== According to the Help for Visual Basic 5.0, the What's This button will appear in the title bar of a form when the WhatsThisHelp property and the WhatsThisButton property are both set to True and the following properties are also set as shown: ControlBox = True MinButton = False and/or MaxButton = False BorderStyle = 1 - Fixed Single or BorderStyle = 2 - Sizable Or BorderStyle = 3 - Fixed Dialog However, the What's This button fails to appear in the title bar of an MDI child form even when the conditions above are met. To work around this problem, you can use the Windows SetParent API to make one form the child of another and create the illusion of an MDI form in which the What's This button is functional. Step-by-Step Instructions ------------------------- 1. Start a new Standard EXE project. Form1 is added by default. 2. Add another form (Form2) to the project. 3. Set the following properties of Form2: MaxButton = False MinButton = False WhatsThisButton = True WhatsThisHelp = True 4. Insert the following code into Form1's General Declarations section: Private Declare Function SetParent Lib "user32" _ (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long 5. Insert the following code into Form1's Form_Load event procedure: Private Sub Form_Load() Dim lngReturnValue As Long 'Set Form1 as the parent of Form2 lngReturnValue = SetParent(Form2.hWnd, Form1.hWnd) Form2.Show End Sub 6. Press F5 to run the program. You will see Form2 acting as Form1's child with a What's This Button on its toolbar. STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- 1. Start a new Standard EXE project. Form1 is added by default. 2. Add a MDI form (MDIForm1) to the project. 3. Set the following properties of Form1: MaxButton = False MDIChild = True MinButton = False WhatsThisButton = True WhatsThisHelp = True 4. Press F5 to run the project. The What's This ('?') button disappears from Form1's title bar. Additional query words: vb5 ====================================================================== Keywords : vb5all VBKBObj VBKBVB Version : WINDOWS:5.0 Platform : WINDOWS Hardware : x86 Issue type : kbbug ============================================================================= 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. Copyright Microsoft Corporation 1997.