When I was working on outlook addin project I had searched lot on outlook addin creation in vc++ but I have found very few documents on the internet that's why when I got success in catching send and new mail event. I planned for updating thing for helping others.
I belive this will give you idea on how to create Add-ins.
Outlook Addin is created using ATL. This code helps you to capture events when Send Mail and New Mail received.
Using the code
Steps for creatding AddIN of outlook.
1. Create new project in vc++6.0. Select "ATL COM AppWizard" as project type and select "Dynamic Link Library" in ATL COM AppWizard Step 1 of 1. Click finish button on that window. ATL project dll is created.
2. In project click on Insert tab and select "New ATL Object". Select "Object" in category and "Simple Object" in objects then click "Next" button. In "Short Name" under Names tab write your add in name. Other tab Attributes select "Support ISupportedErrorInfo". Your AddIn interface is created.
3. Go to class view of your project and right click on your interface class name (Example if you have given interface name "AddIN" then in class view you will find "CAddIN" select this class and right click on that) inside popup click on implement Interface. If you are getting any Warning then just click "OK" button and you will get window with name "Browse Type Libraries". Browse "Microsoft Add-in Designer(1.0) " in that list and select it and click "OK" then you will get window with name "implement Interface" here we have to select "_IDTExtensiblity2" and click "OK".
Wizard will implement default methods of this interface that you can see inside class view. "_IDTExtensiblity2" interface needs to be implemented if we want to create addin of Office.
4. Go to AddIN header file and add following lines.
extern _ATL_FUNC_INFO OnSendInfo;
extern _ATL_FUNC_INFO OnNewMailInfo;
public IDispEventSimpleImpl<1,CADDIN_Chaitanya,&__uuidof(<a href="outlook::ApplicationEvents">Outlook::ApplicationEvents</a>
Points of Interest
When I was going through the net I have not found single application with vc++ syntax explanation. That's why I am giving brief here.IDispEventSimpleImpl this is interface class that needs to be passes parameter properly.First of all you need to understand which event is under which class example some event are of ApplicationEvent some of are ExplorerEvent some are from ItemEvent and some from ItemEvents.
Here two event I have captured that both are of Application Events.
That's why my 3rd passing parameter to IDispEventSimpleImpl is that.
Send Most Important thing is "0x0000F002" this kind of numbers this are dispinterface which we need to specifying inside Begin_Sink_Map for example::
If you will specified some wrong number then problem may happen you may not able to get event. This no you can easily get from net as vb codes.Third Most Important thing is "Advise" and "UnAdvise" in VC syntax is "DispEventAdvise" and "DispEventUnadvise" respectively. If we will not Advise in our code then we can not get event when outlook is generating that event.This 3 are most important factors which need to be understand properly when creating addin otherwise it will create problem for you in getting event of outlook.
If you have any problem then you can make not here. I will try best to give you convicing reply.
Links of Msdn and codeproject which can help you for your understanding and development.
com Add - in
http://msdn2.microsoft.com/en-us/library/aa167881(office.11).aspx http://support.microsoft.com/kb/q241287/ http://support.microsoft.com/kb/q199870/
/////////////////////// Sink Event