I create a c# dynamic object of a COM-Object on the fallowing way:
dynamic pdfCreator = Activator.CreateInstance(
Type.GetTypeFromProg
How about this:
public delegate void eReadyHandler();
static void Main(string[] args)
{
var comType = Type.GetTypeFromProgID("PDFCreator.clsPDFCreator");
dynamic pdfCreator = Activator.CreateInstance(comType);
//dynamic pdfCreator = new PDFCreator.clsPDFCreator();
//pdfCreator.eReady = null;
pdfCreator.eReady += new eReadyHandler(_PDFCreator_eReady);
}
public static void _PDFCreator_eReady()
{
}
I ended up using following as other options did not work. You might have to use generic of < T > if your EventHandler is a generic
pdfCreator.eReady += new System.EventHandler(_PDFCreator_eReady);
Since the delegate type is not known at compile time, you have to specify it. The Action
delegate matches methods with no parameters or return value:
pdfCreator.eReady += new Action(_PDFCreator_eReady);