Maximizing the form

I am quite aware that this might be a pretty stupid question, but anyway. What I am trying to achieve is that my program performs some kind of action when the user maximizes the main form. In other words I need the program to act when user presses Maximize button in the top right corner of the form (standard button for any Windows application).

I tried basically two methods:1) Application.onMaximize event but this one seems to have other purposes. This event is actually not triggered when form is maximized (or I did something wrong).

2) Main form's WinState property. However, this one works kinda strange. I expected it to become wsMaximized when user maximizes the window, but somehow it stays wsNormal, so the program does not do what I want it to.

Comments

: Hello!: : I am quite aware that this might be a pretty stupid question, but anyway. What I am trying to achieve is that my program performs some kind of action when the user maximizes the main form. In other words I need the program to act when user presses Maximize button in the top right corner of the form (standard button for any Windows application).: : I tried basically two methods:: 1) Application.onMaximize event but this one seems to have other purposes. This event is actually not triggered when form is maximized (or I did something wrong).: : 2) Main form's WinState property. However, this one works kinda strange. I expected it to become wsMaximized when user maximizes the window, but somehow it stays wsNormal, so the program does not do what I want it to.: : Any help will be highly appreciated.: You can use the TForm.OnResize() for this, although it will report the previous WindowState. To get arround this, you need to call UpdateWindowState(), before checking the WindowState.