In VB, Double-Click on Control Box Causes MouseUp Event

ID Number: Q79599

1.00

WINDOWS

Summary:

Double-clicking the control box of a form to close it will cause a

MouseUp event on an enabled form or control if it is lying beneath the

control box. This is a standard behavior inherent to Windows, and is

not an error in Visual Basic.

This information applies to Microsoft Visual Basic programming system

version 1.0 for Windows.

More Information:

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.

Additional reference words: 1.00