?? httpdownload.h
字號(hào):
// HTTPDownload.h: interface for the CHTTPDownload class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_HTTPDOWNLOAD_H__BA195238_6DC5_4491_9173_FEC73B994BDC__INCLUDED_)
#define AFX_HTTPDOWNLOAD_H__BA195238_6DC5_4491_9173_FEC73B994BDC__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <afxtempl.h>
#include <afxmt.h>
//This struct is used to save the uncomplished task's info
//Now this program can only start a task once a time.
typedef struct tagDOWNLOADSTATE{
CString url;
CString localfile;
CTime time;
LONG length;
LONG range[8];
}DOWNLOADSTATE,*LPDOWNLOADSTATE;
#define DEFAULT_HTTP_PORT 80
// HTTP STATUS CODE分類
const UINT HTTP_OK = 0;
const UINT HTTP_ERROR = 1;
const UINT HTTP_REDIRECT = 2;
const UINT HTTP_FAIL = 3;
// 發(fā)送請(qǐng)求
const UINT SENDREQUEST_SUCCESS = 0; // 成功
const UINT SENDREQUEST_ERROR = 1; // 一般網(wǎng)絡(luò)錯(cuò)誤,可以重試
const UINT SENDREQUEST_STOP = 2; // 中途停止(用戶中斷) (不用重試)
const UINT SENDREQUEST_FAIL = 3; // 失敗 (不用重試)
class CHTTPDownload
{
public:
UINT ThreadFunc(int index);
CTime GetTime(LPCTSTR lpszTime);
UINT GetInfo(LPCTSTR lpszHeader, DWORD &dwContentLength, DWORD &dwStatusCode, CTime &TimeLastModified);
BOOL StartTask(CString remoteurl, CString localfile);
CHTTPDownload();
virtual ~CHTTPDownload();
public:
CString GetLine(char* lpData, int& ndx);
int GetHeadLength(char* lpData);
UINT SendRequest(BOOL bHead = FALSE);
BOOL ParseURL(CString str);
CTypedPtrList<CPtrList, CAsyncSocket*> m_lsTask;
CString m_strSavePath;
CString m_strTempSavePath;
DOWNLOADSTATE m_state;
BOOL m_bTerminate[4];
CString m_strHead;
CSocket m_pSocket;
CString m_strServer;
CString m_strObject;
CString m_strReferer;
CString m_strDownloadUrl;
CTime m_TimeLastModified;
DWORD m_dwDownloadSize;
BOOL m_bSupportResume;
BOOL m_bResume;
DWORD m_dwFileSize;
UINT m_nPort;
CCriticalSection m_cs;
LONG m_index;
};
#endif // !defined(AFX_HTTPDOWNLOAD_H__BA195238_6DC5_4491_9173_FEC73B994BDC__INCLUDED_)
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -