 |
|
|
|
| Author |
Message |
goran
Joined: 08 Nov 2007 Posts: 18
|
Posted: Tue Jan 22, 2008 10:59 pm Post subject: 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
Archived from group: microsoft>public>outlook>program_addins |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Wed Jan 23, 2008 2:41 pm Post subject: Re: 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 @microsoft.com...
> 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
> |
|
| Back to top |
|
 |
goran
Joined: 08 Nov 2007 Posts: 18
|
Posted: Wed Jan 23, 2008 3:20 pm Post subject: Re: 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
> @microsoft.com...
> > 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
> >
>
> |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Wed Jan 23, 2008 6:36 pm Post subject: Re: 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 @microsoft.com...
> 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 |
|
| Back to top |
|
 |
goran
Joined: 08 Nov 2007 Posts: 18
|
Posted: Mon Jan 28, 2008 3:36 pm Post subject: Re: 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
> @microsoft.com...
> > 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
>
> |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Mon Jan 28, 2008 7:12 pm Post subject: Re: 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 @microsoft.com...
> 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 |
|
| Back to top |
|
 |
goran
Joined: 08 Nov 2007 Posts: 18
|
Posted: Wed Jan 30, 2008 11:25 am Post subject: Re: Inspector Wrapper |
|
|
Thanks a lot Ken,
The Outlook Security warning pops up on the line where I test if the editor
is word editor: if m_objinsp.WordEditor=true. Strange, it has nothing to do
with email addresses.
Goran
"Ken Slovak - [MVP - Outlook]" wrote:
> 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
> @microsoft.com...
> > 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
>
> |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Wed Jan 30, 2008 2:58 pm Post subject: Re: Inspector Wrapper |
|
|
Access to WordEditor is restricted unless you're running in-process on
Outlook 2003 or 2007, or running on Outlook 2007 with up-to-date A-V from an
outside program. If you just want to know if an item is WordMail you can use
the Inspector.IsWordMail Boolean. On Outlook 2007 that will always be true.
I use Redemption so I can get at WordEditor without security restrictions.
Unless you use Redemption you will get the security unless you're running
under the conditions I mentioned above. About the only alternative I've
found is to use Win32 API calls to get at the window that represents the
WordMail window and then find WordEditor under that as a Word.Document
object.
For that I use FindWindow() and GetForegroundWindow() to get the hWnd of the
Inspector window. From there I enumerate the child windows looking for
"OpusApp" as the window caption. From there I look for a child window with a
class name of "_WwG" for Outlook 2003 and lower and for "_WwF" for Outlook
2007. From there I use AccessibleObjectFromWindow() with the resulting hWnd
to look for the required characteristics of UID1 and OBJID_NATIVEOM.
UID1 is defined as UUID with values of:
.Data1 = &H20400
.Data4(0) = &HC0
.Data4(7) = &H46
where UUID is:
Public Type UUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
and OBJID_NATIVEOM is:
Const OBJID_NATIVEOM = &HFFFFFFF0
The result returned by AccessibleObjectFromWindow() is then checked for a
return value of 0 and if that's the case then the ppvObject As Object final
argument to AccessibleObjectFromWindow() is used to get the Word document
object, where if ob is ppvObject then ob.Document is the Word document
object represented by WordEditor.
Lots of Win32 API callbacks there but it's the only safe way to get
WordEditor without triggering the security under conditions where the
security would fire.
You'd have to write your own procedures for that and the Win32 callbacks,
I've never seen this technique documented anywhere, and it took me a lot of
research and testing to come up with the procedures to retrieve WordEditor
that way.
--
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 @microsoft.com...
> Thanks a lot Ken,
>
> The Outlook Security warning pops up on the line where I test if the
> editor
> is word editor: if m_objinsp.WordEditor=true. Strange, it has nothing to
> do
> with email addresses.
>
> Goran |
|
| Back to top |
|
 |
goran
Joined: 08 Nov 2007 Posts: 18
|
Posted: Wed Jan 30, 2008 3:05 pm Post subject: Re: Inspector Wrapper |
|
|
Thanks Ken.
I will use redemption to avoid this. I added the code to disable and make
invisible those toolbars from prevously opened inspectors but now they are
disableb not only onthe current inspectors but in all others that are opened
before. I can't match wrapper with current inspector no matter what I try.
Where should I try to match current inspector with unique tag of wrapper to
be able to see Commandbar1 only in Inspector1 CommandBar2 only in inspector2
etc?
Sorry about this.
Thanks once again,
Goran
"Ken Slovak - [MVP - Outlook]" wrote:
> Access to WordEditor is restricted unless you're running in-process on
> Outlook 2003 or 2007, or running on Outlook 2007 with up-to-date A-V from an
> outside program. If you just want to know if an item is WordMail you can use
> the Inspector.IsWordMail Boolean. On Outlook 2007 that will always be true.
>
> I use Redemption so I can get at WordEditor without security restrictions.
> Unless you use Redemption you will get the security unless you're running
> under the conditions I mentioned above. About the only alternative I've
> found is to use Win32 API calls to get at the window that represents the
> WordMail window and then find WordEditor under that as a Word.Document
> object.
>
> For that I use FindWindow() and GetForegroundWindow() to get the hWnd of the
> Inspector window. From there I enumerate the child windows looking for
> "OpusApp" as the window caption. From there I look for a child window with a
> class name of "_WwG" for Outlook 2003 and lower and for "_WwF" for Outlook
> 2007. From there I use AccessibleObjectFromWindow() with the resulting hWnd
> to look for the required characteristics of UID1 and OBJID_NATIVEOM.
>
> UID1 is defined as UUID with values of:
>
> .Data1 = &H20400
> .Data4(0) = &HC0
> .Data4(7) = &H46
>
> where UUID is:
>
> Public Type UUID
> Data1 As Long
> Data2 As Integer
> Data3 As Integer
> Data4(0 To 7) As Byte
> End Type
>
> and OBJID_NATIVEOM is:
>
> Const OBJID_NATIVEOM = &HFFFFFFF0
>
> The result returned by AccessibleObjectFromWindow() is then checked for a
> return value of 0 and if that's the case then the ppvObject As Object final
> argument to AccessibleObjectFromWindow() is used to get the Word document
> object, where if ob is ppvObject then ob.Document is the Word document
> object represented by WordEditor.
>
> Lots of Win32 API callbacks there but it's the only safe way to get
> WordEditor without triggering the security under conditions where the
> security would fire.
>
> You'd have to write your own procedures for that and the Win32 callbacks,
> I've never seen this technique documented anywhere, and it took me a lot of
> research and testing to come up with the procedures to retrieve WordEditor
> that way.
>
> --
> 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
> @microsoft.com...
> > Thanks a lot Ken,
> >
> > The Outlook Security warning pops up on the line where I test if the
> > editor
> > is word editor: if m_objinsp.WordEditor=true. Strange, it has nothing to
> > do
> > with email addresses.
> >
> > Goran
>
> |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Wed Jan 30, 2008 8:07 pm Post subject: Re: Inspector Wrapper |
|
|
Well, what I do is use a unique string, maybe something like
"myWordMailToolbar". Then I append the Key value of my Inspector wrapper. So
wrapper class with Key = 1 has a Tag value of "myWordMailToolbar1". In
WindowActivate I get the Key value and check for all command bars with the
string "myWordMailToolbar" in their Tag values if the toolbar is BuiltIn =
false. Any that match are my user created toolbars.
Then I match the full Tag value to see which bar belongs to the active
Inspector and enable and make visible that one. Any others with the partial
Tag but a different Key value at the end get disabled and made invisible.
Your mileage may vary.
--
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 @microsoft.com...
> Thanks Ken.
> I will use redemption to avoid this. I added the code to disable and make
> invisible those toolbars from prevously opened inspectors but now they are
> disableb not only onthe current inspectors but in all others that are
> opened
> before. I can't match wrapper with current inspector no matter what I try.
> Where should I try to match current inspector with unique tag of wrapper
> to
> be able to see Commandbar1 only in Inspector1 CommandBar2 only in
> inspector2
> etc?
>
> Sorry about this.
>
> Thanks once again,
>
> Goran |
|
| Back to top |
|
 |
goran
Joined: 08 Nov 2007 Posts: 18
|
Posted: Thu Jan 31, 2008 10:45 am Post subject: Re: Inspector Wrapper |
|
|
Ken,
Thank you very, very much for your help.
Goran
"Ken Slovak - [MVP - Outlook]" wrote:
> Well, what I do is use a unique string, maybe something like
> "myWordMailToolbar". Then I append the Key value of my Inspector wrapper. So
> wrapper class with Key = 1 has a Tag value of "myWordMailToolbar1". In
> WindowActivate I get the Key value and check for all command bars with the
> string "myWordMailToolbar" in their Tag values if the toolbar is BuiltIn =
> false. Any that match are my user created toolbars.
>
> Then I match the full Tag value to see which bar belongs to the active
> Inspector and enable and make visible that one. Any others with the partial
> Tag but a different Key value at the end get disabled and made invisible.
>
> Your mileage may vary.
>
> --
> 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
> @microsoft.com...
> > Thanks Ken.
> > I will use redemption to avoid this. I added the code to disable and make
> > invisible those toolbars from prevously opened inspectors but now they are
> > disableb not only onthe current inspectors but in all others that are
> > opened
> > before. I can't match wrapper with current inspector no matter what I try.
> > Where should I try to match current inspector with unique tag of wrapper
> > to
> > be able to see Commandbar1 only in Inspector1 CommandBar2 only in
> > inspector2
> > etc?
> >
> > Sorry about this.
> >
> > Thanks once again,
> >
> > Goran
>
> |
|
| Back to top |
|
 |
mwebb
Joined: 14 Aug 2007 Posts: 6
|
Posted: Fri Feb 01, 2008 8:00 am Post subject: Re: Inspector Wrapper |
|
|
Hi all,
This code works fine, but when the new Email window is shown - for a moment
the user sees how toolbars are flashing because my code updates CommandBar
collection (it shows/hide my custom toolbars). What can i do with
flashing??? Thanks.
Private Sub Word_WindowActivate(ByVal Doc As
Microsoft.Office.Interop.Word.Document, ByVal Wn As
Microsoft.Office.Interop.Word.Window)
Dim sEmailToolbarName As String = EMAIL_TOOLBAR_NAME
Dim sCurrentToolbar As String = [String].Empty
If Wn.EnvelopeVisible = True Then
Dim sCurrentIndex As String =
Globals.ThisApplication.ActiveInspector.CurrentItem.Companies
Dim sActiveToolBar As String = sEmailToolbarName +
sCurrentIndex
Try
For i As Integer = Doc.CommandBars.Count To 1 Step -1
If Doc.CommandBars.Item(i).BuiltIn = False Then
sCurrentToolbar = Doc.CommandBars.Item(i).Name
If sCurrentToolbar.Contains(sEmailToolbarName) =
True _
AndAlso sCurrentToolbar.Contains(sActiveToolBar)
= False Then
Doc.CommandBars.Item(i).Enabled = False
Doc.CommandBars.Item(i).Visible = False
Continue For
End If
If sCurrentToolbar.Contains(sActiveToolBar) =
True Then
Doc.CommandBars.Item(i).Enabled = True
Doc.CommandBars.Item(i).Visible = True
LoadSettings(Doc.CommandBars.Item(i))
End If
Else
Exit For
End If
Next
Catch ex As Exception
Common.Trace.Log(ex)
End Try
End Sub |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Fri Feb 01, 2008 2:59 pm Post subject: Re: Inspector Wrapper |
|
|
You can try turning off screen updating in Word and see if that helps.
--
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
"mwebb" wrote in message @microsoft.com...
> Hi all,
> This code works fine, but when the new Email window is shown - for a
> moment
> the user sees how toolbars are flashing because my code updates CommandBar
> collection (it shows/hide my custom toolbars). What can i do with
> flashing??? Thanks.
>
> Private Sub Word_WindowActivate(ByVal Doc As
> Microsoft.Office.Interop.Word.Document, ByVal Wn As
> Microsoft.Office.Interop.Word.Window)
> Dim sEmailToolbarName As String = EMAIL_TOOLBAR_NAME
> Dim sCurrentToolbar As String = [String].Empty
> If Wn.EnvelopeVisible = True Then
> Dim sCurrentIndex As String =
> Globals.ThisApplication.ActiveInspector.CurrentItem.Companies
> Dim sActiveToolBar As String = sEmailToolbarName +
> sCurrentIndex
> Try
> For i As Integer = Doc.CommandBars.Count To 1 Step -1
> If Doc.CommandBars.Item(i).BuiltIn = False Then
> sCurrentToolbar = Doc.CommandBars.Item(i).Name
> If sCurrentToolbar.Contains(sEmailToolbarName)
> =
> True _
> AndAlso
> sCurrentToolbar.Contains(sActiveToolBar)
> = False Then
> Doc.CommandBars.Item(i).Enabled = False
> Doc.CommandBars.Item(i).Visible = False
> Continue For
> End If
> If sCurrentToolbar.Contains(sActiveToolBar) =
> True Then
> Doc.CommandBars.Item(i).Enabled = True
> Doc.CommandBars.Item(i).Visible = True
> LoadSettings(Doc.CommandBars.Item(i))
> End If
> Else
> Exit For
> End If
> Next
> Catch ex As Exception
> Common.Trace.Log(ex)
> End Try
> End Sub |
|
| Back to top |
|
 |
goran
Joined: 08 Nov 2007 Posts: 18
|
Posted: Fri Feb 01, 2008 1:43 pm Post subject: Re: Inspector Wrapper |
|
|
or you can minimize inspector window before you start removing CommandBars
and maximize it se activate after you are done.
Thanks,
Goran
"Ken Slovak - [MVP - Outlook]" wrote:
> You can try turning off screen updating in Word and see if that helps.
>
> --
> 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
>
>
> "mwebb" wrote in message
> @microsoft.com...
> > Hi all,
> > This code works fine, but when the new Email window is shown - for a
> > moment
> > the user sees how toolbars are flashing because my code updates CommandBar
> > collection (it shows/hide my custom toolbars). What can i do with
> > flashing??? Thanks.
> >
> > Private Sub Word_WindowActivate(ByVal Doc As
> > Microsoft.Office.Interop.Word.Document, ByVal Wn As
> > Microsoft.Office.Interop.Word.Window)
> > Dim sEmailToolbarName As String = EMAIL_TOOLBAR_NAME
> > Dim sCurrentToolbar As String = [String].Empty
> > If Wn.EnvelopeVisible = True Then
> > Dim sCurrentIndex As String =
> > Globals.ThisApplication.ActiveInspector.CurrentItem.Companies
> > Dim sActiveToolBar As String = sEmailToolbarName +
> > sCurrentIndex
> > Try
> > For i As Integer = Doc.CommandBars.Count To 1 Step -1
> > If Doc.CommandBars.Item(i).BuiltIn = False Then
> > sCurrentToolbar = Doc.CommandBars.Item(i).Name
> > If sCurrentToolbar.Contains(sEmailToolbarName)
> > =
> > True _
> > AndAlso
> > sCurrentToolbar.Contains(sActiveToolBar)
> > = False Then
> > Doc.CommandBars.Item(i).Enabled = False
> > Doc.CommandBars.Item(i).Visible = False
> > Continue For
> > End If
> > If sCurrentToolbar.Contains(sActiveToolBar) =
> > True Then
> > Doc.CommandBars.Item(i).Enabled = True
> > Doc.CommandBars.Item(i).Visible = True
> > LoadSettings(Doc.CommandBars.Item(i))
> > End If
> > Else
> > Exit For
> > End If
> > Next
> > Catch ex As Exception
> > Common.Trace.Log(ex)
> > End Try
> > End Sub
>
> |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Fri Feb 01, 2008 7:00 pm Post subject: Re: Inspector Wrapper |
|
|
That's possible too, but it would flash the window as it was minimized and
then restored.
--
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 @microsoft.com...
> or you can minimize inspector window before you start removing CommandBars
> and maximize it se activate after you are done.
>
> Thanks,
>
> Goran
|
|
| Back to top |
|
 |
|
|
| Related Topics: | New Inspector event in OL2000 when using Word as Editor Hi, We're working on an OL2000 COM addin that adds menu to New Mail window. Based on online literature, we should handle the New Inpsector event, however we found this event will not fire when using Word as email editor. We found the following KB which co
Inspector commandbars and moving between items I'm having troubles getting my commandbar com addin to be stable. I think the trouble is that I'm not dereferencing my object variables before Outlook tries to close them. It seems to happen most when I have an Inspector open, then move the focus of the
Tabulation in Outlook Forms ( Inspector) I have a Problem with tabulation. I must to stop the user on the control (TextBox) when data is incorrect. With the SetFocus method, focus go to the next control all the same. Please tell me how i can to solve the problem. Sorry for my english. Thanks Cla
Inspector.Activate event under VS2005 C#? Hey All, I was wondering if anyone knows how or happens to have a snippet of code demonstrating how to hook into the event under Visual Studio 2005 using C#? This event does not appear under the obvious object model and I'm unsure how t
Business Contact Manager crashes Outlook 2003 With Business Contact Manager installed on WindowsXP SP2 Type email address into "to" field is OK if address is in CONTACTS list. If not, either during typing or upon leaving "to" field there is the error "Business Contact Manager has encoun |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|