LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI ActiveX Server - Create a new control for Outlook 2003

I've been browsing and reading a lot and I just can not seem to find my way around this ActiveX world hidden away in the COM technology world of Microsoft. On the Other hand looking at the ActiveX samples is CVI it seems pretty simple and straightforward unless you want to do something new outside the scope of the few and sparse examples on the subject. The Wizards in CVI works absolutely great, but again, I'm faced with a jungle of options when I'm trying to create a new controller. So I ventured into this forest but soon found myself lost and way in over my head, but I have this nagging feeling that it should be really simple if you can only find the small pieces of information in this haystack of Microsoft documentation to piece it together.

So my objective and bear with me if my understanding and interpretation of ActiveX was wrong. I want to use ActiveX to gain access to my incoming mail messages on Outlook (2000,XP,2003)scan the content and apply a Bayesian filter to it and move the mail to a different folder based on my analyses. In Theory this operation should be transparent between various versions of office, hence the initial objectives of COM and it's subsequent derivatives, but this does not seem to be the case, so it seems like you have to create a separate controller fp for every version of Office, determine the version and then use the appropriate calls.

So back to formulating my initial question(s):

1. My understanding is that I need to create a ActiveX Controller, is that correct?
2. From the very long list of options (servers) which one is most suited for achieving my objectives
3. Once I've created a new fp, how do I determine in what order to call these functions to do what I need to do.

Is there some appropriate references out there that I can reference or is the MS jungle of endless loops and reams of mambo jumbo my only solution.

Any advice or pointers in the right direction will be much appreciated.

Best regards

Jattie van der Linde
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
0 Kudos
Message 1 of 6
(4,052 Views)
1- Yes, you will need to create an ActiveX controller to call the COM methods and properties exposed by outlook.

2- You will (probably) need the one called "Microsoft Outlook 11.0 Object library"

3- This might be a good place to start.

I hope this helps.
Bilal Durrani
NI
Message 2 of 6
(4,038 Views)
The link you gave below refers to VBA so is it true (more or less) that
there's a one-to-one correspondence between COM methods/properties and VBA
methods/properties? If so, then VBA programming examples (and there's a lot
of them out there) might be a good way to learn how to do something in COM.

Nick

"bilalD" <x@no.email> wrote in message news:218568@exchange.ni.com...
> 1- Yes, you will need to create an ActiveX controller to call the COM
methods and properties exposed by outlook.<br><br>2- You will (probably)
need the one called "Microsoft Outlook 11.0 Object library"<br><br>3- <a
href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaol
10/html/olwhatsnew.asp" target=_blank>This</a> might be a good place to
start.<br><br>I hope this helps.


0 Kudos
Message 3 of 6
(4,036 Views)
CVI,

When you compare VBA and COM it's kind of like comparing apples and oranges. From MS website "COM is used by developers to create re-usable software components, link components together to build applications, and take advantage of Windows services." VB on the other hand, is an OO programing language. You can use VB to interact with a COM interface, but the interface has to be built for use with VB. When you create an activeX control in LabWindows/CVI by using the ActiveX Controller Wizard, you are actually using CVI to create a COM interface that can be used with C instead of with VB.

Because C isn't an OO language and VB is, there aren't any examples for ActiveX using VB that you could simply cut and paste into C. But most functions/methods have similar nomenclature and you can usually translate the VB API into the C functions. For programs like MS visio, which have a heavily OO object model the translation can get kind of dicey at times, but it's definately doable.

So to answer your question, yes it is possible to learn how to use a COM interface in C by looking at VB examples, but I personally (and I'm sure there are other people who don't feel this way) find it easier to go straight to a VB API and work from there.
0 Kudos
Message 4 of 6
(4,030 Views)
DaveC,

Your points are well taken. Although the "O" in COM stands for "Object", the
way MS Office Application objects are exposed through ActiveX may have
subtle differences compared to VBA. MS is a big company and it often seems
the "left hand" doesn't know what the "right hand" is doing. However, one
hopes that the architects of VBA and COM at least tried to maintain some
semblance of API consistency for a given application like Outlook and as you
noted, there are usually similarities in naming conventions for methods and
how the methods are used that allow translation from VBA to COM.

I'm guessing (since I don't use Outlook) that the flavor of VBA that is
supported by Outlook 2000 and later might provide a "quick and dirty" way to
help answer Jattie's question #2. I think by recording a macro in an MS
Office application like Outlook, you can quickly generate VBA code by
manually performing the operations that you want to later do
programmatically e.g. accessing incoming email messages and moving them to
certain folders. Once you have the VBA code framework that shows what
methods to use and in what order, I suppose that code can be translated into
corresponding COM methods to be invoked by CVI's C ActiveX wrapper
functions. Of course you'd then have to add code to scan the content and do
Bayesian pattern recognition etc.

As the links below show there's an amazing variety of different ways to
accomplish the automation of routine tasks within Outlook and some are more
backward compatible than others. If it was me, I'd take the lazy man's
approach and just download Spambayes, the free Bayesian spam filter. 😉

http://www.outlookcode.com/d/vb.htm VB and VBA in Outlook Development
http://www.outlookcode.com/d/outtech.htm#model Outlook Object Model
http://www.soundingline.com/magazine/2003/2003_July/spambayes.htm




Message 5 of 6
(4,025 Views)
Thanks guys for all the feedback, pointers and suggestions.
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
0 Kudos
Message 6 of 6
(4,019 Views)