Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application->OnDeactivate 1

Status
Not open for further replies.

hennep

Programmer
Dec 10, 2000
429
Can somebody tell how to use the Application->OnDeactivate event ?
I want to close the current form when the user switches to another application.
 
Hello.

If you have C++Builder5 and above, just place a TApplicationEvents component on the Form and put your code to close the application on the OnDeactivate event.

Another way,

void __fastcall TForm1::AppDeactivate(TObject *Sender)

{
//use
Application->Terminate();
//or close the main form to close the whole application
Form1->Close();
}

void __fastcall TForm1::FormCreate(TObject *Sender)

{
Application->OnDeactivate = AppDeactivate;
}

Hope this helps :)
 
Works great,
thanks !!!

Hennep
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top