Without modifying the Interop assembly, you could cast the object
exposing events to
System.Runtime.InteropServices.UCOMIConnectionPointContainer and handle
COM events the "raw way" instead of using delegates, but it's a
non-trivial amount of work.

Adam

-----Original Message-----
From: Barrie Green [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, April 17, 2002 1:49 AM
To: [EMAIL PROTECTED]
Subject: [DOTNET] com experts please help!

hi all,

I'm trying to develop an office addin, I have got around problems with
the
wizard created setup program not working, but I have now hit a bigger
problem.

Events from office don't work correctly in dotNet land, something to do
with
sinks not implementing IDispatch, the ms bug report Q309336 explains a
way
around this by decompiling the interop dll and changing some il. I have
been
unable to get this to work probably because i'm using office 2000, but
even
if I could I don't really like back engineering autogenerated code.

the problem looks like this at code level:

try
{
  // goes bang here
  _inBox.Items.ItemAdd+= new
Outlook.ItemsEvents_ItemAddEventHandler(OnItemAdded);
}
catch(InvalidCastException ice)
{
  Voice.Speak(ice.ToString(), SpFlags);
}

My question (finally!) is this: is there a way of getting an IDispatch
wrapper around the deletegate and then supplying it to the itemadd
thingy in
that form ?

I suppose I could just write some form of MC++ extension and handle the
sinking via atl....

TIA

bg

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to