when a form is minimized

Schroeder
09-04-2003, 08:49 AM
I would like to find a way to perform an action when someone minimizes the form. I have some code to add an icon to the systray, but I only want to do it when the minimize the form. Is there a way to fire an event when the user minimizes the window? I can't seem to figure out how to do that. All that I can find in MSDN is how to set either set the form as minimized at run-time or how to have the minimize button on the form or not. Any help pointing me to the right direction would be helpful.

passel
09-04-2003, 08:53 AM
This code is from another post. Could you adapt it. It checks the
WindowState in the resize_event.

Private Sub Form_Resize()
Static Hidden As Boolean
On Error Resume Next
If Not hidden Then
If Me.WindowState = vbMinimized Then
Me.Hide
Hidden = True
End If
Else
Me.WindowState = vbNormal
hidden = False
End If
End Sub

00100b
09-04-2003, 08:54 AM
In the Form_Resize event handler, check whether or not WindowState = vbMinimized.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum