A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Inspector Wrapper



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 23rd 08, 01:59 AM posted to microsoft.public.outlook.program_addins
Goran
external usenet poster
 
Posts: 48
Default Inspector Wrapper

Hi,
I used MicroEye example and Ken's InspectorWrapper to create Outlook 2003
add-in. This add-in adds a new CommandBar with a dropdown and command button
to the outlook toolbar. Everything is fine if I open multiple emails from
Inbox. I see exactly one
commandbar with dropdown and a button in it. But when I open multiple new
mail inspectors, it adds 2 command bars for second inspector, 3 for third etc.
It looks like it carries command bars from previously opened inspectors. I
use colInsp_NewInspector method in OutAdddin class to call AddInsp method in
the bas module to add each inspector to the collection.
I use mail_open method to call CreateMenus where I assign unique tag to each
commandbar, dropdown and a button. When I delete one of those commandbars, it
disappears from all open inspectors. I should mention that Email editor is
Word editor. Any ideas?
Thanks in advance,

Goran

  #2  
Old January 23rd 08, 02:41 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Inspector Wrapper

No need to post this 3 times.

WordMail is completely different than an Outlook editor Inspector. In
WordMail for Outlook 2003 and earlier the UI you add gets placed wherever
the CustomizationContext points (Word.Application.CustomizationContext).

That has a number of implications. First, if CustomizationContext.Saved is
False then when Outlook is closed the user will get prompted to save
Normal.dot (if that's where CustomizationContext points) if they have the
setting to be prompted to save Normal.dot. If they don't have that setting
then the UI will just be saved and reappear the next time Word is opened.

Second, any UI you add will appear always unless explicitly removed. Word
doesn't honor the Temporary = True setting you might apply when you create
the UI. So you must explicitly delete the UI you created when the
item/Inspector is closing.

Finally, since Word will show all UI instances not only when WordMail items
are open but also in Word documents (try opening a doc when Inspectors are
open to see that) you need code to see if a Word window is a WordMail window
and which WordMail window if more than one is open.

That final piece is the key. Use a Word event handler to handle
Window_Activate. In that event handler check that window for
wn.EnvelopeVisible = True. If True it's a WordMail window. If False it's a
doc window. In that case you iterate all the Word CommandBars and see which
are yours and which are not. Disable yours and set Visible = False for each
one. If it is WordMail use code to match your unique Tag (which should
include the wrapper class Key value) with the current Inspector. That UI
gets enabled and made visible, any other UI gets disabled and made
invisible.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"goran" wrote in message
...
Hi,
I used MicroEye example and Ken's InspectorWrapper to create Outlook 2003
add-in. This add-in adds a new CommandBar with a dropdown and command
button
to the outlook toolbar. Everything is fine if I open multiple emails from
Inbox. I see exactly one
commandbar with dropdown and a button in it. But when I open multiple new
mail inspectors, it adds 2 command bars for second inspector, 3 for third
etc.
It looks like it carries command bars from previously opened inspectors. I
use colInsp_NewInspector method in OutAdddin class to call AddInsp method
in
the bas module to add each inspector to the collection.
I use mail_open method to call CreateMenus where I assign unique tag to
each
commandbar, dropdown and a button. When I delete one of those commandbars,
it
disappears from all open inspectors. I should mention that Email editor is
Word editor. Any ideas?
Thanks in advance,

Goran


  #3  
Old January 23rd 08, 06:20 PM posted to microsoft.public.outlook.program_addins
Goran
external usenet poster
 
Posts: 48
Default Inspector Wrapper

Ken,

First, sorry about multiple posts, but I was getting an error when I tried
to post, so I thought my post didn't go through. I didn't see my post in the
thread all day yesterday that's why I did this 3 times.
Thanks much for your response. I new WordMail is special, and I explicitly
remove those buttons on mail_close event so I don't have problems with
WordMail saving this commandbar. My only problem is when I have multiple new
mail windows open at the same time. Where do I find Window_Activate event?

Thanks very much,

Goran

"Ken Slovak - [MVP - Outlook]" wrote:

No need to post this 3 times.

WordMail is completely different than an Outlook editor Inspector. In
WordMail for Outlook 2003 and earlier the UI you add gets placed wherever
the CustomizationContext points (Word.Application.CustomizationContext).

That has a number of implications. First, if CustomizationContext.Saved is
False then when Outlook is closed the user will get prompted to save
Normal.dot (if that's where CustomizationContext points) if they have the
setting to be prompted to save Normal.dot. If they don't have that setting
then the UI will just be saved and reappear the next time Word is opened.

Second, any UI you add will appear always unless explicitly removed. Word
doesn't honor the Temporary = True setting you might apply when you create
the UI. So you must explicitly delete the UI you created when the
item/Inspector is closing.

Finally, since Word will show all UI instances not only when WordMail items
are open but also in Word documents (try opening a doc when Inspectors are
open to see that) you need code to see if a Word window is a WordMail window
and which WordMail window if more than one is open.

That final piece is the key. Use a Word event handler to handle
Window_Activate. In that event handler check that window for
wn.EnvelopeVisible = True. If True it's a WordMail window. If False it's a
doc window. In that case you iterate all the Word CommandBars and see which
are yours and which are not. Disable yours and set Visible = False for each
one. If it is WordMail use code to match your unique Tag (which should
include the wrapper class Key value) with the current Inspector. That UI
gets enabled and made visible, any other UI gets disabled and made
invisible.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"goran" wrote in message
...
Hi,
I used MicroEye example and Ken's InspectorWrapper to create Outlook 2003
add-in. This add-in adds a new CommandBar with a dropdown and command
button
to the outlook toolbar. Everything is fine if I open multiple emails from
Inbox. I see exactly one
commandbar with dropdown and a button in it. But when I open multiple new
mail inspectors, it adds 2 command bars for second inspector, 3 for third
etc.
It looks like it carries command bars from previously opened inspectors. I
use colInsp_NewInspector method in OutAdddin class to call AddInsp method
in
the bas module to add each inspector to the collection.
I use mail_open method to call CreateMenus where I assign unique tag to
each
commandbar, dropdown and a button. When I delete one of those commandbars,
it
disappears from all open inspectors. I should mention that Email editor is
Word editor. Any ideas?
Thanks in advance,

Goran



  #4  
Old January 23rd 08, 06:36 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Inspector Wrapper

Inspector.WordEditor is actually a Word.Document object. WordEditor.Parent
is the Word.Application object. If an item is a WordMail item you use that
methodology to get a Word Application object. That allows you to handle Word
events. WindowActivate is a Word.Application event that passes you a window
reference for the window that's being activated.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"goran" wrote in message
...
Ken,

First, sorry about multiple posts, but I was getting an error when I tried
to post, so I thought my post didn't go through. I didn't see my post in
the
thread all day yesterday that's why I did this 3 times.
Thanks much for your response. I new WordMail is special, and I
explicitly
remove those buttons on mail_close event so I don't have problems with
WordMail saving this commandbar. My only problem is when I have multiple
new
mail windows open at the same time. Where do I find Window_Activate event?

Thanks very much,

Goran


  #5  
Old January 28th 08, 06:36 PM posted to microsoft.public.outlook.program_addins
Goran
external usenet poster
 
Posts: 48
Default Inspector Wrapper

Ken,

Thank you very, very much once again.
I did exactly what you said. Got hold of WordMail object, and use
Window_Activate event to check for the CommandBar. In every open window I
make CommandBar from previous window invisible, and I see exactly one
CommandBar in each window.However, If I right-click on the toolbar I see list
of all those Command bars which are not visible. I tried to call
CommadBar.delete instead visible=false but then they dissapear in every
window, even in one where that one should be visible. Any idea how to fix
this? Also, now I get Outlook security warning when I open new email 'A
program is trying to access email addresses..'. How can I avoid this?

Thanks a lot for your time and your help.

Goran

"Ken Slovak - [MVP - Outlook]" wrote:

Inspector.WordEditor is actually a Word.Document object. WordEditor.Parent
is the Word.Application object. If an item is a WordMail item you use that
methodology to get a Word Application object. That allows you to handle Word
events. WindowActivate is a Word.Application event that passes you a window
reference for the window that's being activated.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"goran" wrote in message
...
Ken,

First, sorry about multiple posts, but I was getting an error when I tried
to post, so I thought my post didn't go through. I didn't see my post in
the
thread all day yesterday that's why I did this 3 times.
Thanks much for your response. I new WordMail is special, and I
explicitly
remove those buttons on mail_close event so I don't have problems with
WordMail saving this commandbar. My only problem is when I have multiple
new
mail windows open at the same time. Where do I find Window_Activate event?

Thanks very much,

Goran



  #6  
Old January 28th 08, 07:12 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Inspector Wrapper

Both disable and make invisible those toolbars you want to not show.

I have no idea why you're running into the Outlook object model security
since I don't know what your code is doing or where in your code you're
triggering the security. In general that can be anywhere that you are
possibly harvesting email addresses. See
http://www.outlookcode.com/article.aspx?id=52 for more on the security and
your options.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"goran" wrote in message
...
Ken,

Thank you very, very much once again.
I did exactly what you said. Got hold of WordMail object, and use
Window_Activate event to check for the CommandBar. In every open window I
make CommandBar from previous window invisible, and I see exactly one
CommandBar in each window.However, If I right-click on the toolbar I see
list
of all those Command bars which are not visible. I tried to call
CommadBar.delete instead visible=false but then they dissapear in every
window, even in one where that one should be visible. Any idea how to fix
this? Also, now I get Outlook security warning when I open new email 'A
program is trying to access email addresses..'. How can I avoid this?

Thanks a lot for your time and your help.

Goran


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C# and New Inspector event bstrum Add-ins for Outlook 10 June 12th 07 07:30 PM
Prompt on Delete Wrapper Doug Outlook and VBA 1 August 2nd 06 02:40 PM
Inspector Wrapper utlook 2000 jim Add-ins for Outlook 5 February 17th 06 10:12 PM
Help! Inspector.Close is fired before Inspector.Activate handler finishes Sergey Anchipolevsky Add-ins for Outlook 8 February 9th 06 09:51 AM


All times are GMT +1. The time now is 12:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.