PRB: Double-Clicking Control Box Causes MouseUp Event in VB

Last reviewed: June 21, 1995
Article ID: Q79599
The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, versions 2.0 and 3.0
- Microsoft Visual Basic programming system for Windows, version 1.0

SYMPTOMS

Double-clicking the control box of a form to close it causes a MouseUp event on an enabled form or control if it is lying beneath the control box.

RESOLUTION

You can prevent the above behavior in several ways:

  • Set a global flag in the MouseDown event and check the flag in the MouseUp event. If the flag is set, perform the event and set the flag to FALSE. If the flag is not set, exit the MouseUp event.
  • Set a global flag in the overlapping form's Form_Unload event, and then test this flag in the underlying form or control's MouseUp event.
  • Restrict the placement or movement of a form so that it's control box does not appear above an enabled form or control.
  • Avoid coding the MouseUp event of any enabled form or control over which a control box may appear.

STATUS

This behavior is by design. It is standard behavior inherent to Windows, and is not an error in Visual Basic.


Additional reference words: 1.00 2.00 3.00
KBCategory: kbprg kbprb
KBSubcategory: PrgCtrlsStd


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: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.