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
"bstrum" wrote in message
...
Any code examples? I was using the SafeCOMWrapper from
http://www.codeproject.com/csharp/Sa...97#xx1214201xx
but it doesn't include Inspectors. I added the following but I am getting
invalid cast exception:
[ComEvents(typeof(InspectorsEventSink), InspectorsEventSink.InterfaceID)]
public interface IInspectorsEvents
{
event NewInspectorEventHandler NewInspector;
}
[
ComImport,
Guid(InspectorsEventSink.InterfaceID),
InterfaceType(ComInterfaceType.InterfaceIsIDispatc h),
TypeLibType(TypeLibTypeFlags.FDispatchable)
]
public interface UCOMIInspectorsEvents
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType =
MethodCodeType.Runtime), DispId(0xf001)]
void NewInspector(object NewInspector);
}
[ClassInterface(ClassInterfaceType.None)]
public sealed class InspectorsEventSink : ComEventSink,
UCOMIInspectorsEvents
{
internal const string InterfaceID =
"00063079-0000-0000-C000-000000000046";
static readonly object NewInspectorEvent = new object();
public void NewInspector(object NewInspector)
{
RaiseEvent(NewInspectorEvent, NewInspector);
}
}
public delegate void NewInspectorEventHandler(object NewInspector);
"Dmitry Streblechenko" wrote:
Your object must suppport the IDispatch and IInspectorEvents interfaces .
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"bstrum" wrote in message
...
Does anyone have code to capture the new inspector event from c# using
late
binding? I need to be able to capture this event in an Office version
neutral way.
I put some code together but it fails on the advise method with an
invalid
cast exception.
Guid guid = new Guid("{000????-0000-0000-C000-000000000046}");
UCOMIConnectionPointContainer oCPP =
(UCOMIConnectionPointContainer)app;
oCPP.FindConnectionPoint(ref guid, out m_oConnectionPoint);
m_oConnectionPoint.Advise(this, out m_Cookie);
Thanks,
Benjamin Strum
ThinkTron Corp.