Why is the Delphi main form WindowState returned as "wsNormal" when the window is minimized?

Viewed 5096

I have a monitoring application written in Delphi 7 that runs on part of a secondary monitor. I'd like to have it restore itself to normal visibility if the window gets minimized (for example if I use the the "Windows-D" (view desktop) command on the main monitor)

I tried this code activated by a timer every few seconds:

    if (Mainform.WindowState <> wsNormal ) then
        Mainform.WindowState := wsNormal;      {restore main window if minimized}

It doesn't work. To debug it, I changed the code to log the value of Mainform.WindowState to a file as the program is running. The value remains wsNormal even when the main form's window is minimized. Why?

1 Answers
Related