I need some help . The CFtpConnection object in the code below seems to work well if I comment out the
"if(pFTPSite->Command..." function.
However, when the command function is not commented out, a compilation error occurs.
What is causing this error? The CFtpConnection object is obviously working for the other functions. I have included afxinet.h in the file. I've also installed the latest SDK and added wininet.lib to the project settings for the linker (something I saw in another thread).
The error is,
c:\Visual C++ Applications\UnixScriptGenerator\RunScriptWizard.cpp(929) : error C2039: 'Command' : is not a member of 'CFtpConnection'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxinet.h(371) : see declaration of 'CFtpConnection'
c:\Visual C++ Applications\UnixScriptGenerator\RunScriptWizard.cpp(929) : error C2065: 'CmdRespNone' : undeclared identifier
try{
pFTPSite = sess.GetFtpConnection(pDoc->pDefaultCProfile->m_strFTPServerID,
pDoc->pDefaultCProfile->m_strUserID,pDoc->pDefaultCProfile->m_strUserPassword,
(INTERNET_PORT)pDoc->pDefaultCProfile->m_nPortNumber);
if(pFTPSite->SetCurrentDirectory(pDoc->newRunScript.m_strRemotePathToInputFiles)==0){
AfxMessageBox("Could not set current directory on ftp site",MB_ICONEXCLAMATION);
}
if(pFTPSite->Command("ls *.inp > UnixScriptGenTemp", CmdRespNone, FTP_TRANSFER_TYPE_ASCII, 1)==0){
AfxMessageBox("Could not perform ls command on ftp site",MB_ICONEXCLAMATION);
}
And what do you want now?
Are you sure your CFtpConnection class still has this method?
I don't know which methods does CFtpConnection contain in VC7, but in VC6 there is no such method
you will see that they list Command as one of CFtpConnection's member functions. Additionally, as I type the line of code in, a popup list of available functions appear and Command is one of them. I even selected the function from the popup list. It appears to me that all of the documentation is in place, but the function itself was left out. I am hoping this is not the case because I need to be able to run a command in an ftp connection on a remote server.
Hmmm...
Thanks for the link to MSDN online.
Unfortunately, i cannot every time look at "MSDN online" and my MSDN is from october 2000.
BTW, have you seen the "declaration of 'CFtpConnection'" in c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxinet.h(371), as your compiler had recommended you?
Is there CFtpConnection Command method declared?
According to MSDN ("Using the SDK Headers"): _WIN32_IE >= 0x0500 means that Minimum System Required is Internet Explorer 5.0 and later, i.e Internet Explorer 5.0 or later (or several DLL that are disributed with IE 5.0) must be installed on your computer
Thanks. I found that info too after I made my last post. I checked and as I thought, I'm running IE 6.0 sp1. So somewhere it is not picking up the correct version of IE.
_WIN32_IE is defined at afxv_w32.h ... but it seems to be defined not as your actual version (I'm running IE 6.0 and my define looks like #define _WIN32_IE 0x0560) ...
So, good question! What is really _WIN32_IE?
Perhaps IE version at NET installation time?
Did it help? rate it.
The best conversation I had was over forty million years ago ... and that was with a coffee machine.
I can now successfully compile. I had to supply scope resolution to get CmdResponseNone to work. See the code below. My only problem now is that the command fails in execution because the ls is getting converted to caps somehow. It's never easy!
if(pFTPSite->Command("ls *.inp > UnixScriptGenTemp", CFtpConnection::CmdRespNone, FTP_TRANSFER_TYPE_ASCII, 1)==0){
AfxMessageBox("Could not perform ls command on ftp site",MB_ICONEXCLAMATION);
}
Well I think I have it all figured out now. Although, someone may prove me wrong. It turns out that the set of commands that are available with CFtpConnection::Command are not the same set of commands available to a user in an ftp session. This is a difference in a data ftp connection vs. a control ftp connection. The commands that are available are (at least on the ftp server I'm using),
ftp> remotehelp
214-The following commands are recognized (* =>'s unimplemented).
USER PORT STOR MSAM* RNTO NLST MKD CDUP PBSZ*
PASS PASV APPE MRSQ* ABOR SITE XMKD XCUP PROT*
ACCT* TYPE MLFL* MRCP* DELE SYST RMD STOU SIZE
SMNT* STRU MAIL* ALLO CWD STAT XRMD AUTH* MDTM
REIN* MODE MSND* REST XCWD HELP PWD ADAT*
QUIT RETR MSOM* RNFR LIST NOOP XPWD CCC*
214 Direct comments to user@hostname.
ftp>
So my solution was to discard using this Command function altogether and use instead the class CFtpFileFind which has a code sample in MSDN that provided me the list of files I wanted for my program.
Bookmarks