How to get what the button clicked X or _

When I click X or _ (minimize) I got break point in OnSleep(), how to know which button was clicked?

Hi povetkin,
Could you please give more details about this issue?

Thank you