偶尔看到一个用vc++编写的文件下载程序,为了对其有更深的认识,下面作一点小小分析,不适之处还望见谅。
第一步:分析AfxParseURL函数。
原型:BOOL AFXAPI AfxParseURL(LPCTSTR pstrURL,DWORD& dwServiceType,CString& strServer,CString& strObject,INTERNET_PORT& nPort);
解释:pstrURL: A pointer to a string containing the URL to be parsed.
dwServiceType:Indicates the type of Internet service. Possible values are as follows: (只列出几个值,相见MSDN)