![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#8
|
|||
|
|||
![]()
Again, *why* do you need to do that from the scratch?
Create an interop using the lowest version of Outlook that you are planning to support (Outlook 2000?); then you will need to use late binding only for the features not supported by that version. Otherwise C# is not the best tool for the task i am afraid. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "bstrum" wrote in message ... Does anyone know how to do this? We have spent a lot of time making our code version independent using late binding. We now need to be able to hook into the newinspector event. Here is some more code that I am trying. Right now, it throws an InvalidCast exception on m_oConnectionPoint.Advise(this, out m_Cookie). using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using ThinkTron.Email.Common; using MO = ManagedOffice; using MSWord = ManagedOffice.Word; using MSOutlook = ManagedOffice.Outlook; namespace SSNProtector { [InterfaceType(ComInterfaceType.InterfaceIsIDispatc h), GuidAttribute("00063079-0000-0000-c000-000000000046")] public interface DInspectorEvents { void NewInspector([MarshalAs(UnmanagedType.Struct)]object NewInspector); } class InspectorEventHelper : IDisposable, DInspectorEvents { public InspectorEventHelper() { m_oConnectionPoint = null; m_Cookie = 0; } private IConnectionPoint m_oConnectionPoint; private int m_Cookie; public void SetupConnection(object Inspectors) { if (m_Cookie != 0) return; try { Guid guid = new Guid("{00063079-0000-0000-c000-000000000046}"); IConnectionPointContainer oCPP = (IConnectionPointContainer)Inspectors; oCPP.FindConnectionPoint(ref guid, out m_oConnectionPoint); m_oConnectionPoint.Advise(this, out m_Cookie); } catch (Exception exc) { Log.Write(exc.Message); } } public void RemoveConnection() { if (m_Cookie != 0) { m_oConnectionPoint.Unadvise(m_Cookie); m_oConnectionPoint = null; m_Cookie = 0; } } #region IDisposable Members public void Dispose() { RemoveConnection(); } #endregion //#region DOutlookApplicationEvents_10 Members [DispId(0xF001)] public void NewInspector([MarshalAs(UnmanagedType.Struct)]object NewInspector) { } } } "Dmitry Streblechenko" wrote: But it still requires an interop; the original question was about doing COM event sinking using the low level COM API (IConnectionPointContainer, IConnectionPoint, etc). But I can't imagine why the lowest Outlook version interop (2000?) cannot be used instead... Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Ken Slovak - [MVP - Outlook]" wrote in message ... Helmut Obertanner has an Inspector wrapper example in C# up on www.outlookcode.com. -- 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 "Dmitry Streblechenko" wrote in message ... I have no idea how to do that in C#, sorry. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Htmleditor from Inspector of Newinspector Event | Kavitha Saivam | Outlook - Using Forms | 2 | May 31st 07 03:30 PM |
c++ and New Inspector event | JahMic | Add-ins for Outlook | 2 | March 21st 07 03:25 PM |
selectionchange event for inspector? | jiun | Outlook and VBA | 1 | January 2nd 07 07:35 AM |
Inspector Close Event is fired when spell checking is canceled. | Arcady | Outlook and VBA | 6 | December 28th 06 03:38 PM |
HOWTO: Get the CommandBarComboBox event on the inspector | tonyl | Add-ins for Outlook | 3 | November 7th 06 02:18 PM |