minimizing

When I minimize a form by clicking the minimize button, the WindowState does NOT get set to wsMinimized!  So I had to work around the problem by setting WindowState like so:

 procedure TForm1.SysMen(var msg:TMessage);
 begin
  if msg.wParam = SC_Minimize then
    WindowState := wsMinimized; {...or whatever code you want.}
  else
    Inherited;
 end;

Reason:  When you select the apps minimize, you are minimizing the TApplication, not the TMainForm.   TMainForm will be hidden, and TApplications Icon will be shown.