社区
ATL
帖子详情
如何在ActiveX内下载网站上的文件?
wxq
2000-02-15 09:21:00
我在网页内做了一个控件,想让用户在使用控件时去读取网站上的一个文件。请问,怎样编VC程序才行?网络名UNC是怎么用的?
...全文
179
6
打赏
收藏
如何在ActiveX内下载网站上的文件?
我在网页内做了一个控件,想让用户在使用控件时去读取网站上的一个文件。请问,怎样编VC程序才行?网络名UNC是怎么用的?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
dengdun
2000-02-16
打赏
举报
回复
CInternetSession session(_T("test"), PRE_CONFIG_INTERNET_ACCESS);
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
try
{
CString szURL="http://www.test.com/test.dat"
CString strServerName;
CString strObject;
INTERNET_PORT nPort;
DWORD dwServiceType;
AfxParseURL(szURL,dwServiceType,strServerName,strObject,nPort);
pServer = session.GetHttpConnection(strServerName, nPort);
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET,strObject, NULL,1,NULL,NULL, INTERNET_FLAG_EXISTING_CONNECT and INTERNET_FLAG_NO_AUTO_REDIRECT);
pFile->SendRequest();
TCHAR szTemp[1024];
CFile tempFile;
tempFile.Open("C:\\temp\\temp.dat",CFile::modeCreate and CFile::modeWrite);
int nRead = pFile->Read(szTemp,1023);
while (nRead > 0)
{
szTemp[nRead] = '\0';
tempFile.Write(szTemp,nRead);
nRead = pFile->Read(szTemp, 1023);
}
tempFile.Close();
pFile->Close();
pServer->Close();
}
catch (CInternetException* pEx)
{
TCHAR szErr[1024];
pEx->GetErrorMessage(szErr, 1024);
AfxMessageBox(szErr);
pEx->Delete();
}
if (pFile != NULL)
delete pFile;
if (pServer != NULL)
delete pServer;
session.Close();
dengdun
2000-02-16
打赏
举报
回复
CInternetSession session(_T("test"), PRE_CONFIG_INTERNET_ACCESS);
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
try
{
CString szURL="http://www.test.com/test.dat"
CString strServerName;
CString strObject;
INTERNET_PORT nPort;
DWORD dwServiceType;
AfxParseURL(szURL,dwServiceType,strServerName,strObject,nPort);
pServer = session.GetHttpConnection(strServerName, nPort);
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET,
strObject, NULL, 1, NULL, NULL, INTERNET_FLAG_EXISTING_CONNECT and INTERNET_FLAG_NO_AUTO_REDIRECT);
pFile->SendRequest();
TCHAR szTemp[1024];
CFile tempFile;
tempFile.Open("C:\\temp\\temp.dat",CFile::modeCreate and CFile::modeWrite);
int nRead = pFile->Read(szTemp,1023);
while (nRead > 0)
{
szTemp[nRead] = '\0';
tempFile.Write(szTemp,nRead);
nRead = pFile->Read(szTemp, 1023);
}
tempFile.Close();
pFile->Close();
pServer->Close();
}
catch (CInternetException* pEx)
{
TCHAR szErr[1024];
pEx->GetErrorMessage(szErr, 1024);
AfxMessageBox(szErr);
pEx->Delete();
}
if (pFile != NULL)
delete pFile;
if (pServer != NULL)
delete pServer;
session.Close();
dengdun
2000-02-16
打赏
举报
回复
CInternetSession session(_T("test"), PRE_CONFIG_INTERNET_ACCESS);
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
try
{
CString strServerName;
CString strObject;
INTERNET_PORT nPort;
DWORD dwServiceType;
pServer = session.GetHttpConnection(strServerName, nPort);
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET,
strObject, NULL, 1, NULL, NULL,
INTERNET_FLAG_EXISTING_CONNECT and INTERNET_FLAG_NO_AUTO_REDIRECT);
pFile->SendRequest();
TCHAR szTemp[1024];
CFile tempFile;
tempFile.Open("C:\\temp\\temp.dat",CFile::modeCreate and CFile::modeWrite);
int nRead = pFile->Read(szTemp,1023);
while (nRead > 0)
{
szTemp[nRead] = '\0';
tempFile.Write(szTemp,nRead);
nRead = pFile->Read(szTemp, 1023);
}
tempFile.Close();
pFile->Close();
pServer->Close();
}
catch (CInternetException* pEx)
{
TCHAR szErr[1024];
pEx->GetErrorMessage(szErr, 1024);
AfxMessageBox(szErr);
pEx->Delete();
}
if (pFile != NULL)
delete pFile;
if (pServer != NULL)
delete pServer;
session.Close();
wxq
2000-02-16
打赏
举报
回复
Dou:
Thank you! 若能详细一些更好,最好是代码.
netmare
2000-02-15
打赏
举报
回复
UNC明表示为形如\\主机名\...\共享资源名
如\\.\diskc\share表示本机上的一个共享资源share
DOU
2000-02-15
打赏
举报
回复
可以使用vc中的WinInet API,主要是使用几个类,如: CHttpConnection,CHttpFile,
CFtpConnection,CFtpFileFind,CHtmlStream...等等,具体请查阅MSDN,MSDN里有例子
ACTIVEX
实现大
文件
FTP上传
下载
---上
ACTIVEX
实现大
文件
FTP上传 在Windows 操作系统下,有一个重要的机制,就是OLE ,就是可以让某个应用程序(OLE Controller)访问其它应用程序(OLE Server)所提供的功能,这样做的好处是,如果已经有了完成某项功能的程序,你就不必再为某项功能编写特定的应用程序,可以直接通过OLE 调用。 现在的
ActiveX
控件等价与以前的OLE
编写的
activeX
控件如何被IE调用?
网友大富翁刘卫民的指导意见:1、编写的
activeX
控件如何被IE调用?
ActiveX
被IE调用,给段代码你参考。 CLASSID="CLSID:064A0198-F3AB-478A-8C04-EE647284D9AE" CODEBASE="VPortSDK.cab#version=1,0,0,0">主要是要在Object中指明你控件的ID和ClassID2、IE如何知道需要安装何种Ac
注册
ActiveX
控件 未在此计算机上注册
ActiveX
控件!!!
拿到一个别人发给我的
ActiveX
控件Use项目 但是用VS2008打开项目后,点击资源试图中的Dialog的IDD,出现“未在此计算机上注册
ActiveX
控件”的提示 解决方法: 转自 未在此计算机上注册
ActiveX
控件!!! http://blog.csdn.net/tingge1992/article/details/75085758 1、 将active
文件
工控仪表控件Iocomp
ActiveX
系列教程:LPK
文件
授权
LPK
文件
可以解决在Web页面内对某些
ActiveX
组件进行授权的问题,本文为大家讲解如何为工控仪表控件Iocomp
ActiveX
创建LPK
文件
,以及如何将它集成到HTML页面中。 什么是LPK
文件
LPK
文件
是在IE浏览器下运行时授权给
ActiveX
控件的
文件
。不管制造商是谁,凡是需要授权的
ActiveX
组件都必须创建这个LPK
文件
。 创建LPK
文件
的步骤 1、首先
基于
ActiveX
在B/S模式如何在js中查找读取本地
文件
及
文件
夹
最近要做个功能,要在浏览器其端上传客户本地
文件
夹,查找很久资料,勉强实现,做个记录,本人新手,大神无视我吧。 我们知道B/S模式下,浏览器是不允许js上传
文件
的。如果可以,恶意代码会扫描电脑把敏感
文件
都上传了,所以上传
文件
只能用 而file控件不能通过脚本控制其value,因此我们不能使用file控件来自动上传本地
文件
。这就很尴尬了,然后我找到ie的
ActiveX
,差强人意。 一、首先要
ATL
3,245
社区成员
48,539
社区内容
发帖
与我相关
我的任务
ATL
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
复制链接
扫一扫
分享
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章