There is no event that lets you know when this is going to happen.
However, you can derive from the Form class and override the WndProc method
to process the WM_SYSCOMMAND message. You want to handle the case where
wParam is equal to SC_MINIMIZE.
The Resize event of the form will fire on a minimize. Within the handler,
you can check the WindowState. If it is FormWindowState.Minimized then the
form is being minimized. I have not used this technique before, but you can
check to see if it works for you.
//get the window handle
int hwnd = FindWindow(null,"Some window title");
bool bMinimized = IsIconic(hwnd);
if bMinimized == true //its minimized
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.