Hi Brian, here we go.

Call me an beginning interop expert by now (we pulls some fancy strings
here), but I did not do any office work for years.

Inline with ***


Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)



-----Original Message-----
From: Barrie Green [mailto:[EMAIL PROTECTED]] 
Sent: Mittwoch, 17. April 2002 10:49
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....

*** ok - I give up, no idea :-) Sorry.

*** BUT - IF you know C++, another way to handle this is using C++ nd
ATL to catch the event, THEN forwarding it through a managed wrapper. I
pretty often go down to managed C++ today for things like this :-)

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