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
...
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