#include <tchar.h>
#include <windows.h>
#pragma comment(lib, "Urlmon.lib")
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hpreInstance, char* lpCmdLine, int nShowCmd)
{
HRESULT hret = URLDownloadToFile(NULL, _T("https://s.cctry.com/images/eagle2.png"), _T("./e.png"), 0, NULL);
if (hret == S_OK)
{
MessageBox(NULL, _T("下载成功"), _T("Tips"), MB_OK);
SHELLEXECUTEINFO ShellInfo = { 0 };
ShellInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShellInfo.lpVerb = _T("open");
//ShellInfo.lpFile = _T(" // 可以用默认浏览器打开指定网址
ShellInfo.lpFile = _T("e.png");
ShellInfo.nShow = SW_SHOW;
BOOL bRet = ShellExecuteEx(&ShellInfo);
}
else
{
MessageBox(NULL, _T("下载失败"), _T("Tips"), MB_OK);
}
return 0;
}
访客评论