📄 httpdown.h
字号:
#if !defined(AFX_HTTPDOWN_H__39530BC0_6DE1_11D4_B458_00104B1269BD__INCLUDED_)
#define AFX_HTTPDOWN_H__39530BC0_6DE1_11D4_B458_00104B1269BD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// HttpDown.h : header file
//
#include <afxinet.h>
#define WM_USER_SERVER_STATUS (WM_USER + 10)
#define WM_USER_SEND_ERRINFO (WM_USER + 12)
#define ERROR_INIT_SERVER 10
#define ERROR_URL_NULL 11
#define ERROR_NEW_PARAMS 12
#define ERROR_PARSE_URL 13
#define ERROR_GET_HTTPFILE 14
/////////////////////////////////////////////////////////////////////////////
// CHttpDown window
typedef struct tagURLParams
{
CString m_pszURL;
DWORD m_dwServiceType;
DWORD m_dwContext;
CString m_Contents;
CString m_strServerName;
CString m_strObject;
INTERNET_PORT m_nPort;
CString m_strProxy;
CString m_strPort;
DWORD m_dwTimeOut;
DWORD m_dwIngoreLength;
}URLParams;
class CSearchSession : public CInternetSession
{
public:
CSearchSession(LPCTSTR pstrAgent = NULL,
DWORD dwContext = 1000,
DWORD dwAccessType = INTERNET_OPEN_TYPE_PRECONFIG,
LPCTSTR pstrProxyName = NULL,
LPCTSTR pstrProxyBypass = NULL, DWORD dwFlags = 0 )
: CInternetSession(pstrAgent, dwContext, dwAccessType,
pstrProxyName, pstrProxyBypass, dwFlags)
{
m_pWnd = NULL;
};
// Attributes
public:
HWND m_pWnd; // pointer to window
// CString m_strHttpSite; // current URL
// Operations
public:
virtual void OnStatusCallback(DWORD dwContext,
DWORD dwInternetStatus,LPVOID lpvStatusInfomration,
DWORD dwStatusInformationLen);
};
class CHttpDown
{
// Construction
public:
CHttpDown();
~CHttpDown();
protected:
CSearchSession *m_pSession;
CHttpConnection *m_pServer;
CHttpFile *m_pFile;
CString m_strCurrentServer;
DWORD dwError;
BOOL InitServer(URLParams *pURLParams);
DWORD NewConnection(LPCTSTR ServerName,LPCTSTR strObject,URLParams *pURLParams);
BOOL ParseURL(URLParams *pURLParams);
DWORD GetHttpStatus(LPCTSTR lpServerName,LPCTSTR strObject,URLParams *pURLParams);
BOOL GetHttpFile(LPCTSTR ServerName,LPCTSTR strObject,URLParams *pURLParams);
BOOL CleanUp();
public:
CString GetLastErrorText();
CString GetHttpFileGet(LPCTSTR pstrURL,DWORD dwContext = 1000,
DWORD dwTimeOut = 0,LPCTSTR pstrProxy = NULL,
LPCTSTR pstrPort = NULL,DWORD dwIngoreLength = -1);
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_HTTPDOWN_H__39530BC0_6DE1_11D4_B458_00104B1269BD__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -