Saving outlook Bar Position

Add-in Express™ Support Service
That's what is more important than anything else

Saving outlook Bar Position
Saving to ini file instead of registry 
Nicholas Glasier


Guest


Hi,

I have an adxOLExplorerCommandbar that appears in all explorer windows. Ineed to save its position to an ini file because the registry file is read ony for most users.
the bar and all buttons are temporary.

The following code causes an error each time the commandbar data is written to file.

ini := TiniFile.Create('TestingAddin.ini');
ini.WriteBool('General', 'ConfirmDeletions', fConfirmDeletions);
Ini.WriteInteger('Options', 'OutlookBarPos', Integer(MyTestAddin4Outlook.Position));
Ini.WriteInteger('Options', 'OutlookRow', MyTestAddin4Outlook.RowIndex );
Ini.WriteInteger('Options', 'OutlookTop', MyTestAddin4Outlook.CommandBarTop);
Ini.WriteInteger('Options', 'OutlookLeft', MyTestAddin4Outlook.CommandBarLeft);
ini.Free;

The first write (for a boolean flag) causes no problems but each of the others causes a runtime exception, and I'm assuming that its getting the Commandbar values that causes them. Any ideas please?

I tried it with an ordinary commandbar, and the problem was the same.
Tried the example #17 on a test machine and that worked fine.

Using Delph 7 pro with the latest public build for adx.

TIA, Nick
Posted 25 Mar, 2007 22:15:30 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nick,

In which event handler is your code executed?

P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.


Posted 26 Mar, 2007 07:10:17 Top
Nicholas Glasier


Guest


Hi Dmitry, the code is in the OnAddinBeginShutdown event for the Module.

The same code is working fine for similar addins with other Office apps.

Regards, Nick
Posted 26 Mar, 2007 15:14:47 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nick,

Please try to use the OnOLExplorerClose event of the TAddInModule class.

Posted 27 Mar, 2007 02:53:17 Top
Nicholas Glasier


Guest


Thanks Dmitry, That ceratainly solved the problem. Can you tell me why I need to do that?

Regards, Nick
Posted 27 Mar, 2007 03:55:11 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nick,

Trying to access command bar properties in the OnAddinBeginShutdown event is too late for Outlook solutions. The point is that command bars are members of the _Explorer interface and after the OnOLExplorerClose event is fired, you cannot get access to any Explorer command bar.

Posted 27 Mar, 2007 08:23:03 Top
Nicholas Glasier


Guest


Many thanks Dmitry, I live and learn ( but sometimes slowly:-)

Nick
Posted 27 Mar, 2007 20:13:09 Top