分类: WINDOWS
2012-04-30 01:33:29
实现 | 方法 |
建立一个连接 | 创建CInternetSession对象,它是WinInet Internet客户应用的前提条件 |
打开一个URL | 建立一个连接,调用CInternetSession::OpenURL 函数,返回一个只读资源对象 |
读取 URL 数据 | 打开一个URL,调用CInternetSession::QueryOption |
查询 Internet 选项设置 | 建立一个连接,调用CInternetFile::Read |
设置一个Internet选项 | 建立一个连接,调用CInternetSession::SetOption |
设置一个用状态信息调用的函数 | 建立一个连接,调用CInternetSession::EnableStatusCallback 重写CInternetSession::OnStatusCallback函数 |
关闭连接 | 用CInternetSession对象方法,清除打开的连接 |
为了创建Internet客户端程序,MFC提供了如下的C++类和全程函数:
C++类
综上所述,实现Internet客户端应用的步骤因协议而异。要看你是创建基于OpenURL的一般Internet客户端应用,还是使用GetXXXConnection函数之一针对特定协议的Internet客户端应用。
Wininet api函数列表
Platform SDK: Windows Internet
WinINet Functions
The following are the WinINet functions.
CommitUrlCacheEntry
CreateMD5SSOHash
CreateUrlCacheEntry
CreateUrlCacheGroup
DeleteUrlCacheEntry
DeleteUrlCacheGroup
DetectAutoProxyUrl
FindCloseUrlCache
FindFirstUrlCacheEntry
FindFirstUrlCacheEntryEx
FindFirstUrlCacheGroup
FindNextUrlCacheEntry
FindNextUrlCacheEntryEx
FindNextUrlCacheGroup
FtpCommand
FtpCreateDirectory
FtpDeleteFile
FtpFindFirstFile
FtpGetCurrentDirectory
FtpGetFile
FtpGetFileSize
FtpOpenFile
FtpPutFile
FtpRemoveDirectory
FtpRenameFile
FtpSetCurrentDirectory
GetUrlCacheEntryInfo
GetUrlCacheEntryInfoEx
GetUrlCacheGroupAttribute
GopherAttributEnumerator
GopherCreateLocator
GopherFindFirstFile
GopherGetAttribute
GopherGetLocatorType
GopherOpenFile
HttpAddRequestHeaders
HttpEndRequest
HttpOpenRequest
HttpQueryInfo
HttpSendRequest
HttpSendRequestEx
InternetAttemptConnect
InternetAutodial
InternetAutodialHangup
InternetCanonicalizeUrl
InternetCheckConnection
InternetCloseHandle
InternetCombineUrl
InternetConfirmZoneCrossing
InternetConnect
InternetCrackUrl
InternetCreateUrl
InternetDeInitializeAutoProxyDll
InternetDial
InternetErrorDlg
InternetFindNextFile
InternetGetConnectedState
InternetGetConnectedStateEx
InternetGetCookie
InternetGetCookieEx
InternetGetLastResponseInfo
InternetGetProxyInfo
InternetGoOnline
InternetHangUp
InternetInitializeAutoProxyDll
InternetLockRequestFile
InternetOpen
InternetOpenUrl
InternetQueryDataAvailable
InternetQueryOption
InternetReadFile
InternetReadFileEx
InternetSetCookie
InternetSetCookieEx
InternetSetDialState
InternetSetFilePointer
InternetSetOption
InternetSetOptionEx
InternetSetStatusCallback
InternetStatusCallback
InternetTimeFromSystemTime
InternetTimeToSystemTime
InternetUnlockRequestFile
InternetWriteFile
ReadUrlCacheEntryStream
ResumSuspendedDownload
RetrieveUrlCacheEntryFile
RetrieveUrlCacheEntryStream
SetUrlCacheEntryGroup
SetUrlCacheEntryInfo
SetUrlCacheGroupAttribute
UnlockUrlCacheEntryFile
UnlockUrlCacheEntryStream
The following functions are the WinInet Privacy and Security functions:
InternetClearAllPerSiteCookieDecisions
InternetEnumPerSiteCookieDecisions
InternetGetPerSiteCookieDecisions
InternetSetPerSiteCookieDecisions
InternetGetZonePreferenceW
InternetSetZonePreferenceW