Problem with using ComCom Automation in own Application

I try to use the ComCom Automation Server in my own Delphi Application. It works fine with sending Fiels and receive them in Navision.
Now I want to send File from Navision to Delphi but my Event crahses with a Memory Error. Because you cannot say “WithEvents” like in VB I haven’t any examples how to implement this event. Does anybody has some code for raising a ComCom.MessageReceived() event in Delphi, C or something else?

Here is a how-to:

http://www.mibuso.com/dlinfo.asp?FileID=582

When you set you automation as global variable, you can set some additional properties for thet var. One of it is “WithEvent” boolean option.

If you set that to TRUE, new functions appears in code windows and they are, event functions from that automation.

Though, it isn’t so simple to work with them…