AfterMinimize Event

This event occurs when a user clicks the minimize button on a form that was being watched (see also the AddMinimizeWatch method). This event occurs after the window "zooms" to the system tray.

Syntax

Private Sub csSysTray_AfterMinimize(hWnd As Long)
Private Sub csSysTray_AfterMinimize([index As Integer,] hWnd As Long)

The AfterMinimize event syntax has these parts:

Part Description
csSysTray The SysTray control you are working with.
index An integer that uniquely identifies a control if it's in a control array.
hWnd A handle to the form that was being minimized.

Examples

Example 1 (Responding to an AfterMinimize event with a confirmation message)

Private Sub csSysTray1_AfterMinimize (hWnd As Long)
MsgBox "Window was minimized!"
End Sub

Remarks

You probably want to set the ShowInTaskBar property of the forms you are watching to False at design time.

Also, the Microsoft Windows operating environment identifies each form and control in an application by assigning it a handle, or hWnd. The hWnd property is used with Windows API calls. Many Windows operating environment functions require the hWnd of the active window as an argument.

Note Because the value of a window handle (hWnd) can change while a program is running, never store the hWnd value in a variable.