Re: C++, COM tool - Events are not being called - WeOnlyDo Discussion board

Re: C++, COM tool - Events are not being called (General questions)

by wodSupport, Friday, August 12, 2005, 01:48 (6837 days ago) @ billstamp

Bill,

I just tried that sample with VSNET 2003, and it works correctly for me. I call ListDir from Connected event (making sure blocking is set to false) and EventListItems function is called.

Can you please make sure that your events are defined correctly? These are how my events are defined:
in FtpEventSink.h starting on line 31 [code]void Connected(long ErrorCode, LPCTSTR ErrorText);
void Disconnected();
void StateChange(long OldState);
void HostFingerprint(LPCTSTR Fingerprint, BOOL* Accept);
void HostCertificate(LPDISPATCH Cert, long ErrorCode, LPCTSTR ErrorText, BOOL* Accept);
void Progress(long Position, long Total);
void ListItems(LPCTSTR FileInfo);
void Done(long ErrorCode, LPCTSTR ErrorText);
void Attributes(long Size, long Uid, long Gid, long Permissions, DATE AccessTime, DATE ModificationTime);
void ClientCertRequired();
void FTPReply(LPCTSTR Command, short ReplyCode, LPCTSTR ReplyText);
void PreTranslateCommand(LPCTSTR *Command);
void PreTranslateReply(short *Code, LPCTSTR *Reply);[/code] and their declaration in FtpEventSink.cpp starting on line 56 is like this: [code]DISP_FUNCTION_ID(CEventSink, Connected ,1,Connected,VT_EMPTY,VTS_I4 VTS_BSTR)
DISP_FUNCTION_ID(CEventSink, Disconnected , 2, Disconnected, VT_EMPTY, VTS_NONE)
DISP_FUNCTION_ID(CEventSink, StateChange , 3, StateChange, VT_EMPTY, VTS_I4)
DISP_FUNCTION_ID(CEventSink, HostFingerprint , 4, HostFingerprint, VT_EMPTY, VTS_BSTR VTS_PBOOL)
DISP_FUNCTION_ID(CEventSink, HostCertificate , 5, HostCertificate, VT_EMPTY,VTS_DISPATCH VTS_I4 VTS_PBOOL)
DISP_FUNCTION_ID(CEventSink, Progress , 6, Progress, VT_EMPTY, VTS_I4 VTS_I4)
DISP_FUNCTION_ID(CEventSink, ListItems , 7, ListItems, VT_EMPTY, VTS_BSTR)
DISP_FUNCTION_ID(CEventSink, Done , 8, Done, VT_EMPTY, VTS_I4 VTS_BSTR)
DISP_FUNCTION_ID(CEventSink, Attributes , 9, Attributes, VT_EMPTY, VTS_I4 VTS_I4 VTS_I4 VTS_I4 VTS_DATE VTS_DATE)
DISP_FUNCTION_ID(CEventSink, ClientCertRequired , 10, ClientCertRequired, VT_EMPTY, VTS_NONE)
DISP_FUNCTION_ID(CEventSink, FTPReply , 11, FTPReply, VT_EMPTY, VTS_BSTR VTS_I2 VTS_BSTR)
DISP_FUNCTION_ID(CEventSink, PreTranslateCommand , 12, PreTranslateCommand, VT_EMPTY, VTS_PBSTR)
DISP_FUNCTION_ID(CEventSink, PreTranslateReply , 13, PreTranslateReply, VT_EMPTY, VTS_PI2 VTS_PBSTR)[/code]. Can you please check you have the same?


Complete thread: