Using IwodFtpNotify in C++/MFC - WeOnlyDo Discussion board

Using IwodFtpNotify in C++/MFC (General questions)

by carl, Thursday, October 13, 2005, 14:25 (6980 days ago)

Hi,

I would like to handle the events using the IwodFtpNotify class. I'm unable to get the member functions of that class called. My code is the following:


CwodFtpDLXCom m_Ftp;
CwodFtpNotify *pm_notify;

pm_notify = new CwodFtpNotify();

//---> m_Ftp.putref_Notification(pm_notify);
//does not compile because putref_Notification is the following:
//void putref_Notification(LPDISPATCH newValue)

//trying other way (it compiles):
m_Ftp.putref_Notification(pm_notify->m_lpDispatch);


m_Ftp.put_Hostname(*host);
m_Ftp.put_Login(*user);
m_Ftp.put_Password(*passwd);
m_Ftp.put_Protocol(PROTOCOL_FTP);


VARIANT var;
var.vt = VT_ERROR;


m_Ftp.Connect(var,var,var);
Wait();
//but no event is fired.

Another question: Is there a way to check if Connect() is done after calling it? For example, a member function like IsDone() or something like that. I would like to perform this check along others inside the Wait() function.

Re: Using IwodFtpNotify in C++/MFC

by wodSupport, Thursday, October 13, 2005, 17:48 (6980 days ago) @ carl

Carl,

IwodFtpNotify isn't C++ class, it should be interface, so you should initialize it somehow with CreateDispatch or whatever API is used in MFC. When you do that, you will be able to pass it's handle to SetCertificate property.
If you can send me your code (to techsupport@weonlydo.com) I'll try to see if we can convert it to interface class.

Another question: Is there a way to check if Connect() is done after calling it?

You can check state using GetState, if it says 'Connected' then Connect is finished. However, in nonblocking mode you should wait for Connected event, in blocking mode Connect will not return at all before it connects, so both ways there's regular way to determine when connection is established.