Closing a CAB application

  • Thread starter Thread starter Peter Hurford
  • Start date Start date
P

Peter Hurford

Hi,

I have an application based upon Microsoft's CAB. There is a shell
application comprising ui extension sites, deck workspace etc. plus
several modules which are listed in the profilecatalog.

In general the modules are nothing more complicated than UserControls
containing DataGridViews, this kind of thing.

What I want to do is to trap when the user decides to close the
application, and when this happens for the modules to be able to do
some "tidy up" work. (For example, in one module I want to persist the
widths/presence of the datagridview columns, for the next time.)

However I am having a great deal of trouble hooking into any kind of
"close" event. Simplest of all, I couldn't find anything off the
UserControl or the DataGridView which told me when they were being
destroyed.

Other things I have tried so far have included trapping the WorkItem's
Terminating event. This fired, but only after the ui had been
destroyed, too late to write any data from the screen. Also, I hooked
my module into the Workspace's SmartPartClosing event, but this event
didn't fire.

I can't help thinking that this should be really obvious, and that
maybe I'm missing something. Any ideas anyone? Thanks.
 
Forget it, HandleDestroyed was my friend.

Quite clean also since I didn't have to go near the CAB code.
 
Back
Top