Click to See Complete Forum and Search --> : Catching the Minimized button


August 8th, 1999, 05:28 PM
My very favorite form has MinButton = True. I want to call my very favorite procedure (Private Sub MinimizeEvent) when the user clicks the MinButton. Any way to do this?

Ravi Kiran
August 8th, 1999, 07:30 PM
Simple direct VB way would be to catch the _Resize event and check for Me.Minismized=True

private Sub Form_Resize()
if me.Minimized = true then
Call MyFavoriteMinimizeProcedure
'or
RaiseEvent MyFavoriteMinimiseEvent '!!
exit sub
end if
' else handle it if you care!
end sub




Another (pure) API way would be to subclass the form. When the user clicks any of the control-box buttons you get a WM_SYSCOMMAND (with command type = SC_MINIMIZE, for Minimise btn ) event . You can latch on to this to do your processing. This would be under the hood of VB.

RK