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?
Because the main form is not minimized. When the application is minimized, VCL just hides the main form. You can test if the application is minimized and restore if so:
if IsIconic(Application.Handle) then
Application.Restore;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With