右键,网页源码中就有下载地址。[FONT-COLOR=Red]注意:获取的下载地址不能直接下载,需要用迅雷或者旋风工具下载。另外,对于源码中没有下载地址的很多网站,包括视频等,都可以利用Google的Chrome浏览器的开发者工具嗅探出真实的下载地址。[/FONT-COLOR]
比如:http://voice.5ige.cn/ilmusic/voice/viewer.do?artist=4150
真实下载地址:http://fs.5ige.cn/fs/media/4150/1343096404845.mp3
VC代码:
[CODE=cplusplus]
void CMy5igeDlg::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
CInternetSession httpSession;
CInternetFile *htmlFile = (CInternetFile*)httpSession.OpenURL(m_addr);
CString content;
while (htmlFile->ReadString(content))
{
m_html += content + " ";
}
htmlFile->Close();
httpSession.Close();
if(!m_html.IsEmpty())
{
int i = m_html.Find(_T(".mp3"),0);
CString tmp = m_html.Left(i+4);
int j = tmp.Find(_T("mp3:"),0);
tmp = tmp.Right(i-j-2);
m_html = tmp;
}
UpdateData(FALSE);
}
[/CODE]
再贴一段屏蔽MFC对话框回车和ESC键的代码:
[CODE=cplusplus]
BOOL CMy5igeDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN)
{
if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE)
{
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
[/CODE]
已经有(0)位网友发表了评论,你也评一评吧!
原创文章如转载,请注明:转载自Eddy Blog
原文地址:http://www.rrgod.com/skill/832.html 欢迎订阅Eddy Blog。