Persist toolbar visible state

Status
Not open for further replies.
S

Saeed

I have added few buttons in a new toolbar using VSTO 2005, which I add during

the add-in startup. User can set its visibility using customize>toolbars. I

want to persist the state of toolbar i.e. if Outlook is closed when toolbar

was not visible, the toolbar should not be visible on next startup. For doing

this I am trying to keep the state of toolbar visibility in registry. Is

there an event of closing the outlook when I can read the state of toolbar

visibility and save it in registry? Add-in shutdown does not work as the

explorers are closed by that time.

Is there an standard way of doing this I mean not through registry?
 
K

Ken Slovak - [MVP - Outlook]

You can persist the settings anywhere you want, for example in the user

settings for the addin or the registry or a file stored somewhere, that's up

to you.

Handle the Explorer.Close() event and get the visibility in that event

handler.

"Saeed" <Saeed> wrote in message

news:345609B6-9BF2-4D47-82A9-5A3BA3A59F00@microsoft.com...
> I have added few buttons in a new toolbar using VSTO 2005, which I add
> during
> the add-in startup. User can set its visibility using customize>toolbars.
> I
> want to persist the state of toolbar i.e. if Outlook is closed when
> toolbar
> was not visible, the toolbar should not be visible on next startup. For
> doing
> this I am trying to keep the state of toolbar visibility in registry. Is
> there an event of closing the outlook when I can read the state of toolbar
> visibility and save it in registry? Add-in shutdown does not work as the
> explorers are closed by that time.

> Is there an standard way of doing this I mean not through registry?
 
S

Saeed

Thanks Ken. Can you please give me fully qualified namesapce for class

Explorer which you have mentioned. I could not find any class which provides

Close as event. I am using VSTO 2005 with C#.
wrote:


> You can persist the settings anywhere you want, for example in the user
> settings for the addin or the registry or a file stored somewhere, that's up
> to you.

> Handle the Explorer.Close() event and get the visibility in that event
> handler.

> >

>

> "Saeed" <Saeed> wrote in message
> news:345609B6-9BF2-4D47-82A9-5A3BA3A59F00@microsoft.com...
> >I have added few buttons in a new toolbar using VSTO 2005, which I add
> >during
> > the add-in startup. User can set its visibility using customize>toolbars.
> > I
> > want to persist the state of toolbar i.e. if Outlook is closed when
> > toolbar
> > was not visible, the toolbar should not be visible on next startup. For
> > doing
> > this I am trying to keep the state of toolbar visibility in registry. Is
> > there an event of closing the outlook when I can read the state of toolbar
> > visibility and save it in registry? Add-in shutdown does not work as the
> > explorers are closed by that time.
> > Is there an standard way of doing this I mean not through registry?


>
 
K

Ken Slovak - [MVP - Outlook]

Where you have overloaded names such as the Close() method and the Close()

event you can usually use something like ExplorerEvents. I'd add that event

handler in C# using code something like this:

((Outlook.ExplorerEvents_Event)_expl).Close += new

Outlook.ExplorerEvents_CloseEventHandler(ExplClose);

_expl is an Explorer object declared at class level.

"Saeed" <Saeed> wrote in message

news:9B6D407F-22AE-42F9-9188-73BC86CCF09E@microsoft.com...
> Thanks Ken. Can you please give me fully qualified namesapce for class
> Explorer which you have mentioned. I could not find any class which
> provides
> Close as event. I am using VSTO 2005 with C#.
 
S

Saeed

Hi Ken,

I am able to get the event now. But the problem is not solved because by the

time of this event active explorer is closed and I do not get reference to

the toolbar to check if it was visible last time or not. Is there any event

for the case when use clicks customize toolbar and enables or disables any

toolbar. My whole aim is to keep my toolbar visibility as previous case i.e.

before outlook was closed.
wrote:


> Where you have overloaded names such as the Close() method and the Close()
> event you can usually use something like ExplorerEvents. I'd add that event
> handler in C# using code something like this:

> ((Outlook.ExplorerEvents_Event)_expl).Close += new
> Outlook.ExplorerEvents_CloseEventHandler(ExplClose);

> _expl is an Explorer object declared at class level.

> >

>

> "Saeed" <Saeed> wrote in message
> news:9B6D407F-22AE-42F9-9188-73BC86CCF09E@microsoft.com...
> > Thanks Ken. Can you please give me fully qualified namesapce for class
> > Explorer which you have mentioned. I could not find any class which
> > provides
> > Close as event. I am using VSTO 2005 with C#.


>
 
K

Ken Slovak - [MVP - Outlook]

The Close() event should not be firing after the Explorer is already closed.

Your toolbar reference should be in place long before that event, you should

be getting and maintaining it when you create the UI.

"Saeed" <Saeed> wrote in message

news:97352612-0F02-4435-9C5E-1B273288C64B@microsoft.com...
> Hi Ken,
> I am able to get the event now. But the problem is not solved because by
> the
> time of this event active explorer is closed and I do not get reference to
> the toolbar to check if it was visible last time or not. Is there any
> event
> for the case when use clicks customize toolbar and enables or disables any
> toolbar. My whole aim is to keep my toolbar visibility as previous case
> i.e.
> before outlook was closed.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
V How to persist attributes of a calendar folder and its items? Outlook VBA and Custom Forms 2
C Persist the email format and attachments / images while replying A Outlook VBA and Custom Forms 5
C Persist all recipients on Item forward event Outlook VBA and Custom Forms 5
G How to add a folder shortcut to outlook quick access toolbar? Using Outlook 6
O Outlook 365 - Toolbar - Close all items - missing? Using Outlook 3
O Windows 1803 update : QAT and toolbar changed, language pack gone... Using Outlook 5
R Categorize Button in Quick Access Toolbar Disappears on New Email Using Outlook 1
F want inbox on toolbar to reference icloud messages Using Outlook 2
Diane Poremsky Synchronize Quick Access Toolbar and Ribbons? Using Outlook 0
soadfan Enable all rules from toolbar button? Outlook VBA and Custom Forms 3
J Adding Reply & Delete to main toolbar? Using Outlook 0
Diane Poremsky Customize the Outlook Toolbar, Ribbon or QAT Using Outlook 0
L Outlook 2007 Custom Form and Toolbar Not Working Using Outlook 5
E Outlook 2007: Problem with "Move to Folder >" button on toolbar Using Outlook 6
B Outlook 2007 Save Current View,Font,Toolbar Settings Using Outlook 6
L Outlook 2007 Toolbar Export and Import Using Outlook 7
V Avast! Antispam toolbar Using Outlook 11
B Trouble Locating Tools Menu since There's No Standard Toolbar in Office 2010 Using Outlook 1
N Combobox in outlook add ons toolbar not firing event on main window resized Using Outlook 3
B Outlook Toolbar disabled Using Outlook 1
P Can't add a custom hyperlink to toolbar in OL 2010 Using Outlook 1
E Blank Print Preview when access via the Quick Access toolbar Using Outlook 3
Commodore Back/Forward toolbar buttons with pull-down history? Using Outlook 5
D How can I add a user created template to the toolbar Outlook VBA and Custom Forms 1
D How do I run a rule by using a toolbar icon? Outlook VBA and Custom Forms 4
S How to Create Buttons in email body / toolbar Outlook VBA and Custom Forms 3
P Problem in temporary type toolbar Outlook VBA and Custom Forms 1
P Problem in permanent type add-in toolbar Outlook VBA and Custom Forms 6
P Create TextBox in Outlook toolbar Outlook VBA and Custom Forms 1
T Quick Access Toolbar Using Outlook 3
S inspector toolbar buttons get multiple events Outlook VBA and Custom Forms 3
S toolbar visible state change event Outlook VBA and Custom Forms 1
S show icon while toolbar button is disabled. Outlook VBA and Custom Forms 1
S Quick access toolbar in inspector window Outlook VBA and Custom Forms 3
J Excel 2002 Forms toolbar Outlook VBA and Custom Forms 1
R How to implement customize toolbar in outlook? Outlook VBA and Custom Forms 1
J Toolbar button to process current mailitem Outlook VBA and Custom Forms 1
C Re: Hide BCM toolbar BCM (Business Contact Manager) 1
T Creating toolbar in new Explorer Outlook VBA and Custom Forms 3
R How to add toolbar to MailEditor for outlook? Outlook VBA and Custom Forms 14
H Add an item to the "new" - option in outlook toolbar Outlook VBA and Custom Forms 6
Q Re: Detecting whether a toolbar is and should be shown Outlook VBA and Custom Forms 5
F Email being marked as Spam by Gmail and not being visible in Outlook Using Outlook 5
T Outlook 2010 Tasks are not visible in To Do list Using Outlook 5
T Outlook Template - textbox visible based on combobox selection Using Outlook 1
N Custom Form Controls Not Visible To Recipient Outlook VBA and Custom Forms 3
J How to restore field no longer visible in field chooser? Using Outlook 1
M Outlook 2003 pictures - some visible, some not Using Outlook 0
0 Emails showing up in Search results, but not visible otherwise Using Outlook 3
W Shared inbox sub folders not visible when moved Using Outlook 3

Similar threads

Top