How to remember toolbar position.

  • Thread starter Thread starter Vinayakc
  • Start date Start date
V

Vinayakc

Hi all,

Can anyone please tell me how we can remember add-in toolbar position
which user set in previous session of Outlook.
OutlookSpy remembers it.

Thanks and Regards
Vinayakc
 
Save the CommandBar.Position property when the window is about to be closed
and set it when creating the toolbar next time.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Hi Dmitry,
Thanks for your help.
Dmitry I heard that OL2003 remembers toolbar positions itself.
Is there any other way aprt from storing the positions in regisrty or
..ini file.
Can we specify any property for CommandBar while adding it to toolbar.

Thanks and Regards
Vinayakc
 
Outlook will remember the toolbar position if you create the toolbar as
non-temporary when calling CommandBars.Add.
The downside however is that if your app is uninstalled, Outlook will
recreate a (now non-functional) toolbar when it starts.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Hi Dmitry,

Thanks!
I have tried the solution which you gave me in your previous reply.

I am using following code to set the toolbar position:

SetToolBarPostion()
{
HRESULT hr = S_OK;
BOOL bRet = TRUE;
LONG lPosition;
Office::MsoBarPosition ePos;
INT iRowIndex;
INT iLeftPos;
INT iTopPos;
try
{
bRet = m_RegHelper.GetNumericValuesFromRegistry( &lPosition, POSITION
, DEFAULT_POSITION_FOR_FTUE);

ePos = (Office::MsoBarPosition)lPosition;
hr = m_pCommandBar->put_Position(ePos);
if( ePos != Office::msoBarFloating )
{
bRet = m_RegHelper.GetNumericValuesFromRegistry((LONG*) &iRowIndex,
ROW_INDEX , DEFAULT_POSITION_FOR_FTUE);

if( iRowIndex != DEFAULT_POSITION_FOR_FTUE )
{
hr =
m_pCommandBar->put_RowIndex((Office::MsoBarPosition)iRowIndex);

}
}
bRet = m_RegHelper.GetNumericValuesFromRegistry((LONG*) &iLeftPos,
LEFT_POS , DEFAULT_POSITION_FOR_FTUE);

if( iLeftPos != DEFAULT_POSITION_FOR_FTUE )
{
hr = m_pCommandBar->put_Left((Office::MsoBarPosition)iLeftPos);

}
if(ePos != Office::msoBarTop || ePos != Office::msoBarBottom)
{
bRet = m_RegHelper.GetNumericValuesFromRegistry((LONG*) &iTopPos,
TOP_POS , DEFAULT_POSITION_FOR_FTUE);

if( iTopPos != DEFAULT_POSITION_FOR_FTUE)
{
hr = m_pCommandBar->put_Top((Office::MsoBarPosition)iTopPos);

}
}

}


This code works fine.
But Outlook does not remember the position of that when I placed it
above menu bar.

I don't know why it is happening because I am setting it's row index as
well as left postion when it is in the Docking mode.

Thanks
Vinayakc
 
Hi Dmitry,

I have just tried permanent toolbar also.
you are right, when my application gets uninstall plug-in will not get
removed from toolbar.
What is the solution for this?
I am using installshield for installation/uninstallation of add-in?

Thanks and Regards
vinayakc
 
Always create a toolbar using the Temporary := True setting. The alternative
is to run a script in InstallShield on removing the installation that would
start Outlook with a UI and delete the toolbar. That's ugly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top