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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do another task when I press the X button

Status
Not open for further replies.

seba18

Programmer
Jul 26, 2004
38
0
0
How can I associate another task with the close application button?
 
You can, but why?

The simplest way is to use the Form_QueryUnload Event, check the value of UnloadMode and set the cancel variable true.

something like
Code:
Private Sub Form_QueryUnload(cancel As Integer, unloadmode As Integer)
select case unloadmode
  case vbFormControlMenu
      'Do your task here
       Cancel = 1 'cancel form close
  case else
       cancel = 0
end select
end sub

but I can't see why you would want to do this!

Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
The reason for doing this is that I want to minimize the application in SystemTray(or ask user to minimize or close the program)

Thank's for the point mattKnight !
 
but I can't see why you would want to do this!

Oh I can now...


Glad it works

Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top