Click here to Skip to main content
15,915,603 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionQuestion about recursion Pin
ericelysia17-Feb-06 15:35
ericelysia17-Feb-06 15:35 
AnswerRe: Question about recursion Pin
Michael Dunn17-Feb-06 16:22
sitebuilderMichael Dunn17-Feb-06 16:22 
GeneralRe: Question about recursion Pin
ericelysia17-Feb-06 16:36
ericelysia17-Feb-06 16:36 
GeneralRe: Question about recursion Pin
ericelysia17-Feb-06 18:54
ericelysia17-Feb-06 18:54 
AnswerRe: Question about recursion Pin
David Crow18-Feb-06 7:13
David Crow18-Feb-06 7:13 
AnswerRe: Question about recursion Pin
Jeremy Thornton18-Feb-06 9:10
Jeremy Thornton18-Feb-06 9:10 
AnswerRe: Question about recursion Pin
ericelysia20-Feb-06 3:37
ericelysia20-Feb-06 3:37 
QuestionWinInet FtpPutFile Pin
rbrad1234517-Feb-06 15:21
rbrad1234517-Feb-06 15:21 
Hello everyone,

I'm writing a simple class to handle FTP SEND of a file from a WinCE 4.2 box. I'm having some trouble with the FtpPutFile call. I've tried several FTP servers using a valid username & password and get the same error every time.

InternetOpen succeeds, InternetConnect succeeds, FtpPutFile returns FALSE, GetLastError returns 12018.

The error message 12018 is defined in WinInet.h as follows
#define ERROR_INTERNET_INCORRECT_HANDLE_TYPE 12018
The type of handle supplied is incorrect for this operation.

Any input is greatly appreciated!

<br />
void CWinInetTestDlg::OnPut() <br />
{<br />
	DWORD err = 0;<br />
	CString str;<br />
<br />
	<br />
	HINTERNET hInternet = 0;<br />
<br />
<br />
	//	InternetOpen Params<br />
	LPCTSTR agent = _T("FTP");<br />
	DWORD dwAccessType = INTERNET_OPEN_TYPE_PRECONFIG;<br />
	LPCTSTR proxy = 0;<br />
	LPCTSTR bypass = 0;<br />
	DWORD flags = 0;<br />
<br />
<br />
	//	InternetConnect Params<br />
	LPCTSTR server = _T("X.X.X.X");<br />
	INTERNET_PORT port = INTERNET_DEFAULT_FTP_PORT;<br />
	LPCTSTR user = _T("user_name");<br />
	LPCTSTR pass = _T("password");<br />
	DWORD service = INTERNET_SERVICE_FTP;<br />
	DWORD context = 0;<br />
<br />
<br />
	//	FtpPutFile Params<br />
	LPCTSTR szLocalFile = _T("\\TEST.TXT");<br />
	LPCTSTR szRemoteFile = _T("\\TEST.TXT");<br />
<br />
<br />
<br />
	hInternet = InternetOpen(agent, dwAccessType, proxy, bypass, flags);<br />
	if (hInternet) {<br />
		<br />
		//flags = INTERNET_FLAG_PASSIVE;<br />
		flags = 0;<br />
		if (InternetConnect(<br />
			hInternet, <br />
			server, <br />
			port, <br />
			user, <br />
			pass, <br />
			service, <br />
			flags, <br />
			context)) {<br />
<br />
			flags = INTERNET_FLAG_TRANSFER_BINARY;<br />
			<br />
			if ( FtpPutFile(<br />
				hInternet, <br />
				szLocalFile, <br />
				szRemoteFile, <br />
				flags, <br />
				context) ) {<br />
				<br />
				MessageBox(<br />
					_T("FtpPutFile Success!"), <br />
					_T("WinInet FTP Test"),<br />
					MB_OK);<br />
<br />
			}else{<br />
				err = GetLastError();<br />
				str.Format(_T("FtpPutFile Error: %d"), err);<br />
				MessageBox(str, _T("WinInet FTP Test"),MB_OK);<br />
			}//FTPPutFile<br />
<br />
		}else{<br />
			err = GetLastError();<br />
			str.Format(_T("InternetConnect Error: %d"), err);<br />
			MessageBox(str, _T("WinInet FTP Test"),MB_OK);<br />
		}//InternetConnect<br />
<br />
		if (!InternetCloseHandle(hInternet)) {<br />
			err = GetLastError();<br />
			str.Format(_T("Error %d"), err);<br />
			MessageBox(str, _T("WinInet FTP Test"),MB_OK);<br />
		}//InternetCloseHandle<br />
<br />
	}else{<br />
		err = GetLastError();<br />
		str.Format(_T("InternetOpen Failed with code %d"), err);<br />
		MessageBox(str, _T("WinInet FTP Test"),MB_OK);<br />
	}//InternetOpen<br />
	<br />
}



-Ryan Bradley
AnswerRe: WinInet FtpPutFile Pin
Michael Dunn17-Feb-06 15:53
sitebuilderMichael Dunn17-Feb-06 15:53 
GeneralRe: WinInet FtpPutFile Pin
rbrad1234518-Feb-06 16:48
rbrad1234518-Feb-06 16:48 
QuestionMFC42UD.lib Pin
super17-Feb-06 13:56
professionalsuper17-Feb-06 13:56 
AnswerRe: MFC42UD.lib Pin
super17-Feb-06 14:04
professionalsuper17-Feb-06 14:04 
QuestionReading file with X/Y axes? Pin
Lord Kixdemp17-Feb-06 13:20
Lord Kixdemp17-Feb-06 13:20 
AnswerRe: Reading file with X/Y axes? Pin
Lord Kixdemp17-Feb-06 15:40
Lord Kixdemp17-Feb-06 15:40 
Question[registry] get all values in a key Pin
Sam 200617-Feb-06 12:42
Sam 200617-Feb-06 12:42 
AnswerRe: [registry] get all values in a key Pin
Michael Dunn17-Feb-06 15:54
sitebuilderMichael Dunn17-Feb-06 15:54 
GeneralRe: [registry] get all values in a key Pin
Sam 200618-Feb-06 4:55
Sam 200618-Feb-06 4:55 
AnswerRe: [registry] get all values in a key Pin
Ganesh_T18-Feb-06 1:40
Ganesh_T18-Feb-06 1:40 
GeneralRe: [registry] get all values in a key Pin
Sam 200618-Feb-06 5:26
Sam 200618-Feb-06 5:26 
QuestionHow include extern DLL's as static Library into project? Pin
@LX17-Feb-06 12:42
@LX17-Feb-06 12:42 
AnswerRe: How include extern DLL's as static Library into project? Pin
John M. Drescher17-Feb-06 13:29
John M. Drescher17-Feb-06 13:29 
AnswerRe: How include extern DLL's as static Library into project? Pin
Michael Dunn17-Feb-06 15:55
sitebuilderMichael Dunn17-Feb-06 15:55 
AnswerRe: How include extern DLL's as static Library into project? Pin
Koushik Biswas18-Feb-06 14:38
Koushik Biswas18-Feb-06 14:38 
QuestionWindow Handle,Class, FindWindow API Pin
john john mackey17-Feb-06 11:31
john john mackey17-Feb-06 11:31 
QuestionRe: Window Handle,Class, FindWindow API Pin
David Crow17-Feb-06 11:58
David Crow17-Feb-06 11:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.