Versie 3.13: FTP object ook PutFile functie
svn path=/Slnkdwf/trunk/; revision=20485
This commit is contained in:
@@ -104,7 +104,7 @@ STDMETHODIMP CFTP::put_Flags(LONG newVal)
|
||||
CString inetError(CString method, CString func)
|
||||
{
|
||||
DWORD errcode = GetLastError();
|
||||
CString err;
|
||||
CString err;
|
||||
|
||||
if (errcode != ERROR_INTERNET_EXTENDED_ERROR)
|
||||
{
|
||||
@@ -131,8 +131,8 @@ STDMETHODIMP CFTP::Open()
|
||||
|
||||
if (!m_hInternetOpen)
|
||||
{
|
||||
m_hInternetOpen = InternetOpen(FTPAGENT,
|
||||
m_Proxyname==""?0:1, /*UseProxy*/
|
||||
m_hInternetOpen = InternetOpen(FTPAGENT,
|
||||
m_Proxyname==""?0:1, /*UseProxy*/
|
||||
m_Proxyname, /*ProxyName*/
|
||||
NULL, /*ProxyBypass*/
|
||||
0); /*Flags*/
|
||||
@@ -141,8 +141,8 @@ STDMETHODIMP CFTP::Open()
|
||||
return AtlReportError (GetObjectCLSID(), inetError("CFTP::Open", "InternetOpen"));
|
||||
}
|
||||
|
||||
m_hInternetConnect = InternetConnect(m_hInternetOpen,
|
||||
m_Hostname, m_Port,
|
||||
m_hInternetConnect = InternetConnect(m_hInternetOpen,
|
||||
m_Hostname, m_Port,
|
||||
m_Username, m_Password,
|
||||
INTERNET_SERVICE_FTP, m_Flags, NULL);
|
||||
if (!m_hInternetConnect)
|
||||
@@ -154,11 +154,23 @@ STDMETHODIMP CFTP::Open()
|
||||
STDMETHODIMP CFTP::SetCurrentDir(BSTR Directory)
|
||||
{
|
||||
if (!m_hInternetConnect)
|
||||
return AtlReportError (GetObjectCLSID(), "\nCFTP::PutFileFromTextData open first");
|
||||
return AtlReportError (GetObjectCLSID(), "\nCFTP::PutFSetCurrentDirileFromTextData open first");
|
||||
|
||||
BOOL success = FtpSetCurrentDirectory(m_hInternetConnect, CString(Directory));
|
||||
if (!success)
|
||||
return AtlReportError (GetObjectCLSID(), inetError("CFTP::PutFileFromTextData", "InternetWriteFile"));
|
||||
return AtlReportError (GetObjectCLSID(), inetError("CFTP::SetCurrentDir", "FtpSetCurrentDirectory"));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CFTP::PutFile(BSTR remoteFileName, BSTR localFileName)
|
||||
{
|
||||
if (!m_hInternetConnect)
|
||||
return AtlReportError (GetObjectCLSID(), "\nCFTP::PutFile open first");
|
||||
|
||||
BOOL success = FtpPutFile(m_hInternetConnect, CString(localFileName), CString(remoteFileName), FTP_TRANSFER_TYPE_BINARY, 0);
|
||||
if (!success)
|
||||
return AtlReportError (GetObjectCLSID(), inetError("CFTP::PutFile", "FtpPutFile"));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -169,7 +181,7 @@ STDMETHODIMP CFTP::PutFileFromTextData(BSTR remoteFileName, BSTR data)
|
||||
return AtlReportError (GetObjectCLSID(), "\nCFTP::PutFileFromTextData open first");
|
||||
|
||||
CString sData(data);
|
||||
HINTERNET hFile = FtpOpenFile(m_hInternetConnect, CString(remoteFileName),
|
||||
HINTERNET hFile = FtpOpenFile(m_hInternetConnect, CString(remoteFileName),
|
||||
GENERIC_WRITE, FTP_TRANSFER_TYPE_BINARY, 0);
|
||||
if (!hFile)
|
||||
return AtlReportError (GetObjectCLSID(), inetError("CFTP::PutFileFromTextData", "FtpOpenFile"));
|
||||
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
STDMETHOD(Open)();
|
||||
STDMETHOD(SetCurrentDir)(BSTR Directory);
|
||||
STDMETHOD(PutFileFromTextData)(BSTR remoteFileName, BSTR data);
|
||||
STDMETHOD(PutFile)(BSTR remoteFileName, BSTR localFileName);
|
||||
STDMETHOD(Close)();
|
||||
|
||||
private:
|
||||
|
||||
@@ -404,19 +404,20 @@ interface IFTP : IDispatch{
|
||||
[id(1), helpstring("method Open")] HRESULT Open();
|
||||
[id(2), helpstring("method SetCurrentDir")] HRESULT SetCurrentDir([in] BSTR Directory);
|
||||
[id(3), helpstring("method PutFileFromTextData")] HRESULT PutFileFromTextData([in] BSTR remoteFileName, [in] BSTR data);
|
||||
[id(4), helpstring("method Close")] HRESULT Close();
|
||||
[propget, id(5), helpstring("property Proxyname")] HRESULT Proxyname([out, retval] BSTR* pVal);
|
||||
[propput, id(5), helpstring("property Proxyname")] HRESULT Proxyname([in] BSTR newVal);
|
||||
[propget, id(6), helpstring("property Hostname")] HRESULT Hostname([out, retval] BSTR* pVal);
|
||||
[propput, id(6), helpstring("property Hostname")] HRESULT Hostname([in] BSTR newVal);
|
||||
[propget, id(7), helpstring("property Port")] HRESULT Port([out, retval] LONG* pVal);
|
||||
[propput, id(7), helpstring("property Port")] HRESULT Port([in] LONG newVal);
|
||||
[propget, id(8), helpstring("property Username")] HRESULT Username([out, retval] BSTR* pVal);
|
||||
[propput, id(8), helpstring("property Username")] HRESULT Username([in] BSTR newVal);
|
||||
[propget, id(9), helpstring("property Password")] HRESULT Password([out, retval] BSTR* pVal);
|
||||
[propput, id(9), helpstring("property Password")] HRESULT Password([in] BSTR newVal);
|
||||
[propget, id(10), helpstring("property Flags")] HRESULT Flags([out, retval] LONG* pVal);
|
||||
[propput, id(10), helpstring("property Flags")] HRESULT Flags([in] LONG newVal);
|
||||
[id(4), helpstring("method PutFile")] HRESULT PutFile([in] BSTR remoteFileName, [in] BSTR localFileName);
|
||||
[id(5), helpstring("method Close")] HRESULT Close();
|
||||
[propget, id(6), helpstring("property Proxyname")] HRESULT Proxyname([out, retval] BSTR* pVal);
|
||||
[propput, id(6), helpstring("property Proxyname")] HRESULT Proxyname([in] BSTR newVal);
|
||||
[propget, id(7), helpstring("property Hostname")] HRESULT Hostname([out, retval] BSTR* pVal);
|
||||
[propput, id(7), helpstring("property Hostname")] HRESULT Hostname([in] BSTR newVal);
|
||||
[propget, id(8), helpstring("property Port")] HRESULT Port([out, retval] LONG* pVal);
|
||||
[propput, id(8), helpstring("property Port")] HRESULT Port([in] LONG newVal);
|
||||
[propget, id(9), helpstring("property Username")] HRESULT Username([out, retval] BSTR* pVal);
|
||||
[propput, id(9), helpstring("property Username")] HRESULT Username([in] BSTR newVal);
|
||||
[propget, id(10), helpstring("property Password")] HRESULT Password([out, retval] BSTR* pVal);
|
||||
[propput, id(10), helpstring("property Password")] HRESULT Password([in] BSTR newVal);
|
||||
[propget, id(11), helpstring("property Flags")] HRESULT Flags([out, retval] LONG* pVal);
|
||||
[propput, id(11), helpstring("property Flags")] HRESULT Flags([in] LONG newVal);
|
||||
|
||||
};
|
||||
[
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Zorg dat versies alfabetisch altijd op elkaar volgen!
|
||||
#define SLNK_MAJOR_VERSION 3
|
||||
#define SLNK_MINOR_VERSION 12
|
||||
#define SLNK_MINOR_VERSION 13
|
||||
#define SLNK_BUILD_VERSION 0
|
||||
|
||||
// Define resource strings
|
||||
|
||||
Reference in New Issue
Block a user