Click here to Skip to main content
15,918,596 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: downloader Pin
monsieur_jj11-May-08 20:02
monsieur_jj11-May-08 20:02 
GeneralRe: downloader Pin
Steve Echols11-May-08 20:20
Steve Echols11-May-08 20:20 
GeneralRe: downloader Pin
monsieur_jj11-May-08 22:15
monsieur_jj11-May-08 22:15 
GeneralRe: downloader Pin
Stuart Dootson12-May-08 22:12
professionalStuart Dootson12-May-08 22:12 
GeneralRe: downloader Pin
monsieur_jj13-May-08 17:27
monsieur_jj13-May-08 17:27 
GeneralRe: downloader Pin
Stuart Dootson13-May-08 22:31
professionalStuart Dootson13-May-08 22:31 
GeneralRe: downloader Pin
monsieur_jj13-May-08 22:50
monsieur_jj13-May-08 22:50 
GeneralRe: downloader Pin
monsieur_jj14-May-08 16:59
monsieur_jj14-May-08 16:59 
I got the header sorted out now, i got an important question though. How can I prevent the re-download of the file if it is already successfilly downloaded because the problem is that after i successfully downloaded the file and restarted my program it downloads again and adds the files to the complete files thus doubling the size of the file and making the file useless.

<br />
std::string strTmpFileName = "Temp_OutlookAddinInstallerBuild_30.zip";<br />
	std::string strFileNameAtLocalMachine= "OutlookAddinInstallerBuild_30.zip";<br />
<br />
	CString strStaus;<br />
	double dCurrentFileSize;<br />
<br />
	DWORD dwBytesWrrittenToFile =0;<br />
<br />
	if(IfLocalFileExist(strTmpFileName.c_str(), &dCurrentFileSize)) <br />
	{<br />
		dOffsetToSeek				= dCurrentFileSize;<br />
	}<br />
	<br />
	CString strRangeQuest;<br />
<br />
	if(dCurrentFileSize>0){   <br />
	strRangeQuest.Format( _T("%sRange: bytes=%d-\r\n"), szHeaders,static_cast<ULONGLONG>(dCurrentFileSize));<br />
	}<br />
	else        <br />
	strRangeQuest = szHeaders;<br />
<br />
	dwBytesWrrittenToFile = dOffsetToSeek;<br />
<br />
	 if  ( !(pFile = fopen (strTmpFileName.c_str(), "ab" ) ) )<br />
	   {<br />
			CString strMsg;<br />
			strMsg.Format("Error:%d", GetLastError());<br />
			return false;<br />
	   }<br />
	 if(dOffsetToSeek >=0)<br />
	   {<br />
			strStaus.Format("Seeking to local file...");<br />
			int n = fseek(pFile, dOffsetToSeek, SEEK_SET);<br />
	   }<br />
<br />
	//step1<br />
	CInternetSession Session(_T("Test Application"));<br />
	//step2<br />
	CHttpConnection Connection1(Session,_T("http://10.5.1.4/downloads/OutlookAddin/OutlookAddinInstallerBuild_30.zip"));<br />
	//step 3<br />
	BYTE Buffer[4096];<br />
<br />
	CHttpFile File2(Session,_T("http://10.5.1.4/downloads/OutlookAddin/OutlookAddinInstallerBuild_30.zip"));<br />
	CInternetFile::CInfo Info(File2);<br />
	File2.SendRequest(strRangeQuest);<br />
	int FileSize = Info.GetTotalDataLength();<br />
	<br />
	if (FileSize == dCurrentFileSize)<br />
	{<br />
	return 0;<br />
	}<br />
<br />
	for (DWORD dwRead2;dwRead2=File2.Read(Buffer,sizeof(Buffer));)<br />
	{<br />
		 fwrite(Buffer, sizeof (char), dwRead2 , pFile);	<br />
	}<br />
<br />
		MoveFile(strTmpFileName.c_str(), strFileNameAtLocalMachine.c_str() );<br />
<br />
	return 0;<br />


Thanks,
jayjay
GeneralRe: downloader Pin
Stuart Dootson14-May-08 22:05
professionalStuart Dootson14-May-08 22:05 
GeneralRe: downloader Pin
monsieur_jj13-May-08 22:43
monsieur_jj13-May-08 22:43 
Questionhelp on exe generation by other exe Pin
alex7869-May-08 4:53
alex7869-May-08 4:53 
AnswerRe: help on exe generation by other exe Pin
Stuart Dootson12-May-08 22:27
professionalStuart Dootson12-May-08 22:27 
QuestionRead data from a serial port Pin
hari_honey8-May-08 20:58
hari_honey8-May-08 20:58 
QuestionRe: Read data from a serial port Pin
Cedric Moonen8-May-08 21:11
Cedric Moonen8-May-08 21:11 
AnswerRe: Read data from a serial port Pin
hari_honey8-May-08 21:46
hari_honey8-May-08 21:46 
GeneralRe: Read data from a serial port Pin
CPallini11-May-08 21:54
mveCPallini11-May-08 21:54 
QuestionMinimize button does not work on Vista with Aero (using PropertySheets) Pin
howard_khan18-May-08 6:37
howard_khan18-May-08 6:37 
Questionerror compling dll Pin
alex7867-May-08 3:47
alex7867-May-08 3:47 
AnswerRe: error compling dll Pin
Cedric Moonen8-May-08 21:10
Cedric Moonen8-May-08 21:10 
QuestionFunctionality similar to mcafee site advisor browser plugin Pin
bikramthapa7-May-08 2:18
bikramthapa7-May-08 2:18 
QuestionCatching a WM_MOUSEMOVE from a popup menu opened from IE-toolbar Pin
amosygal6-May-08 23:42
amosygal6-May-08 23:42 
QuestionFire Event from Worker thread in ATL COM Loaded on a Web Page Pin
garammasala5-May-08 23:52
garammasala5-May-08 23:52 
QuestionAtlAdvise returns 0x80040201 [modified] Pin
Scorp1us1-May-08 8:28
Scorp1us1-May-08 8:28 
QuestionPopup Menu sends "UnInit" Before sending a command Pin
yytg1-May-08 4:43
yytg1-May-08 4:43 
QuestionC2440 Pin
T.RATHA KRISHNAN30-Apr-08 19:37
T.RATHA KRISHNAN30-Apr-08 19:37 

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.