PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming how to detect programmatically if some code is runing in wordmail

Reply

how to detect programmatically if some code is runing in wordmail

 
Thread Tools Rate Thread
Old 10-03-2006, 09:47 AM   #1
=?Utf-8?B?SGVydmUgY2FkaWV1?=
Guest
 
Posts: n/a
Default how to detect programmatically if some code is runing in wordmail


Hi dear all,
I have some code running in a com add-in with a Word connector , and I would
like to know from this code if the word application instance running the dll
code is a standalone word application or a wordmail instance.

if it is a wordmail instance , I would like to be able from the routine to
send the mail from the current outlook inspector. How can I achieve this ?

Any sample code is much appreciated
Best regards
  Reply With Quote
Old 10-03-2006, 03:31 PM   #2
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: how to detect programmatically if some code is runing in wordmail

Window.EnvelopeVisible = True tells you that it's a WordMail item.

Offhand I don't know of a way to get from that Word window back to the
specific Outlook Inspector directly. You could iterate the
Outlook.Inspectors collection and look for the Caption of each Inspector
window and compare it to the caption of the Word window. That wouldn't work
however until the first Inspector.Activate event had fired already.

You could get the class name of the Word window from the Win32 API and then
look for all open classes in Windows to match the class id. You could look
for a class of "OpusApp".

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Herve cadieu" <Hervecadieu@discussions.microsoft.com> wrote in message
news:CAA0A8F0-61A7-4DBB-A08A-214A72E13707@microsoft.com...
> Hi dear all,
> I have some code running in a com add-in with a Word connector , and I
> would
> like to know from this code if the word application instance running the
> dll
> code is a standalone word application or a wordmail instance.
>
> if it is a wordmail instance , I would like to be able from the routine to
> send the mail from the current outlook inspector. How can I achieve this ?
>
> Any sample code is much appreciated
> Best regards


  Reply With Quote
Old 11-03-2006, 04:28 AM   #3
=?Utf-8?B?SGVydmUgY2FkaWV1?=
Guest
 
Posts: n/a
Default Re: how to detect programmatically if some code is runing in wordm

First of all Thank you much for your kind answer Ken,
Thank you much for the first point according to window.envelopeVisible=true

The second point is still not clear to me , could you show me a little
snippet ?

thank you much ken

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

> Window.EnvelopeVisible = True tells you that it's a WordMail item.
>
> Offhand I don't know of a way to get from that Word window back to the
> specific Outlook Inspector directly. You could iterate the
> Outlook.Inspectors collection and look for the Caption of each Inspector
> window and compare it to the caption of the Word window. That wouldn't work
> however until the first Inspector.Activate event had fired already.
>
> You could get the class name of the Word window from the Win32 API and then
> look for all open classes in Windows to match the class id. You could look
> for a class of "OpusApp".
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "Herve cadieu" <Hervecadieu@discussions.microsoft.com> wrote in message
> news:CAA0A8F0-61A7-4DBB-A08A-214A72E13707@microsoft.com...
> > Hi dear all,
> > I have some code running in a com add-in with a Word connector , and I
> > would
> > like to know from this code if the word application instance running the
> > dll
> > code is a standalone word application or a wordmail instance.
> >
> > if it is a wordmail instance , I would like to be able from the routine to
> > send the mail from the current outlook inspector. How can I achieve this ?
> >
> > Any sample code is much appreciated
> > Best regards

>
>

  Reply With Quote
Old 13-03-2006, 03:56 PM   #4
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: how to detect programmatically if some code is runing in wordm

You could get the Word Window.Caption since you have your Word code. Then
you could get the Outlook Inspectors collection and iterate it. For each
Inspector check Inspector.Caption and see if they match. If so that most
likely is the WordMail window.

An alternative is to use FindWindow in the Win32 API to get the window with
that caption, then you can use GetClassName to verify that it's "OpusApp" to
make sure it's a WordMail window.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Herve cadieu" <Hervecadieu@discussions.microsoft.com> wrote in message
news:AE4B3DD0-96A5-4E8F-A36A-17ED6FE51D81@microsoft.com...
> First of all Thank you much for your kind answer Ken,
> Thank you much for the first point according to
> window.envelopeVisible=true
>
> The second point is still not clear to me , could you show me a little
> snippet ?
>
> thank you much ken


  Reply With Quote
Old 13-03-2006, 04:15 PM   #5
=?Utf-8?B?SGVydmUgY2FkaWV1?=
Guest
 
Posts: n/a
Default Re: how to detect programmatically if some code is runing in wordm

Thanks Ken,

From that when I get the right inspector item in outlook , what piece code
is needed to send the said email after checking that I ghave at least one
recipient filled ?



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

> You could get the Word Window.Caption since you have your Word code. Then
> you could get the Outlook Inspectors collection and iterate it. For each
> Inspector check Inspector.Caption and see if they match. If so that most
> likely is the WordMail window.
>
> An alternative is to use FindWindow in the Win32 API to get the window with
> that caption, then you can use GetClassName to verify that it's "OpusApp" to
> make sure it's a WordMail window.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "Herve cadieu" <Hervecadieu@discussions.microsoft.com> wrote in message
> news:AE4B3DD0-96A5-4E8F-A36A-17ED6FE51D81@microsoft.com...
> > First of all Thank you much for your kind answer Ken,
> > Thank you much for the first point according to
> > window.envelopeVisible=true
> >
> > The second point is still not clear to me , could you show me a little
> > snippet ?
> >
> > thank you much ken

>
>

  Reply With Quote
Old 14-03-2006, 03:36 PM   #6
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: how to detect programmatically if some code is runing in wordm

Item.Send. Use the Object Browser to check for all methods, events and
properties.

That would bring up the security prompts unless this is a trusted COM addin
however. Outlook 2003 will trust a correctly written COM addin (you derive
your Outlook application object from the Application object passed in
On_Connection and all Outlook objects from that Application object). Earlier
versions require use of the Exchange public folders security admin form to
be trusted. And .NET addins are never trusted.

I usually use Redemption (www.dimastr.com/redemption) to avoid all the
security problems and therefore I don't have to worry about Outlook version
and whether it trusts addins or if Exchange is being used.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Herve cadieu" <Hervecadieu@discussions.microsoft.com> wrote in message
news:EDD45FDA-DAEF-4E2E-9389-A0152B70A4FB@microsoft.com...
> Thanks Ken,
>
> From that when I get the right inspector item in outlook , what piece code
> is needed to send the said email after checking that I ghave at least one
> recipient filled ?


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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