I have written an app in VB to handle Before_FormatPage event on an export but I now need to re-write it into a C dll, I have got the object working and exporting okay using :

#import "C:\Program Files\Common Files\Crystal Decisions\1.0\Bin\craxddrt20.dll" no_namespace

IApplicationPtr m_pApp;
IReportPtr m_pRep;


(Obviously not the full code but you get the idea).

I have never used COM in C before and don't have a clue where to start, I found this code in the crystal reports .tli file:

#pragma implementation_key(2)
inline HRESULT CRAXDDRT20::IReportEvent::BeforeFormatPage ( long PageNumber ) {
return _com_dispatch_method(this, 0x2, DISPATCH_METHOD, VT_EMPTY, NULL,
L"\x0003", PageNumber);

Can someone point me in the right direction on how to handle the event?

Thanks in advance.