main window deactivation

  • Thread starter Thread starter shark
  • Start date Start date
S

shark

Hi

I have simple question. How to catch the event when my main application
window is being minimized or sent to background by another application (no
its own window)

Thanks

Shark
 
shark said:
Hi

I have simple question. How to catch the event when my main application
window is being minimized or sent to background by another application (no
its own window)

Thanks

Shark

In System.Windows.Forms.Form

there are functions like

OnDeactivate(EventArgs e)

I think you need find the right functions to override, do something like
that.

protected override OnDeactivate(EventArgs e)
{
base.OnDeactivate(e);
//Do your stuff here..

}

Here is what it says in MSDN..

Raising an event invokes the event handler through a delegate. For more
information, see Raising an Event.

The OnDeactivate method also allows derived classes to handle the event
without attaching a delegate. This is the preferred technique for
handling the event in a derived class.

Notes to Inheritors: When overriding OnDeactivate in a derived class, be
sure to call the base class's OnDeactivate method so that registered
delegates receive the event.
 

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.

Ask a Question

Back
Top