OnDisconnection is too late. You should call it -- along with other shutdown and cleanup code -- when the last Explorer window closes, using the Explorer.Close event. Helmut Obertanner's sample at http://www.outlookcode.com/codedetail.aspx?id=1336 shows how to set up that event handler with C#.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "ian" <iscrivens[ at ]hotmail.com> wrote in message news:1156427800.434645.177250[ at ]m79g2000cwm.googlegroups.com...
[Quoted Text] >I have written a shared add-in which is used in Outlook, the add-in > creates a commandbar. > > I would like to save the position of the commandbar, and have project > settings to hold the necessary infomation. I want to save this > informaiton when the user closes down outlook, but I do not know the > correct place to call this code from. I have the following code: > > private void SaveCommandBarSettings() > { > Properties.Settings.Default["CommandBarTop"] = > myCommandBar.Top; > Properties.Settings.Default["CommandBarLeft"] = > myCommandBar.Left; > Properties.Settings.Default["CommandBarVisible"] = > myCommandBar.Visible; > Properties.Settings.Default["CommandBarPosition"] = > (int)myCommandBar.Position; > Properties.Settings.Default["CommandBarRowIndex"] = > myCommandBar.RowIndex; > Properties.Settings.Default.Save(); > } > > I have tried calling this from OnBeginShutdown and OnDisconnection but > in both instances the commandbar object is not available. Does anyone > know where I am going wrong? > > Thanks, > > Ian >
|