上传activeX控件,怎么写啊,大家给点意见吧。

zjjhfwh 2006-06-13 12:49:54
C++的第一个任务,实现上传功能的activeX控件。要断点续传。 一点思路都没有。大家给点意见吧,谢谢
...全文
194 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjjhfwh 2006-06-13
  • 打赏
  • 举报
回复
各位大哥。给点意见吧。先谢了
zjjhfwh 2006-06-13
  • 打赏
  • 举报
回复
有这方面源码吗?
zjjhfwh 2006-06-13
  • 打赏
  • 举报
回复
谢谢niying(逆颖
niying 2006-06-13
  • 打赏
  • 举报
回复
我这两天也搞这个,不过上传不成功.不知道什么原因,代码如下:
DWORD dwHttpRequestFlags= INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT | INTERNET_FLAG_TRANSFER_BINARY;
CString csServer = "127.0.0.1";
INTERNET_PORT nPort = 80;

CInternetSession *pSession = new CInternetSession("upload");

CHttpConnection *pHttpConn = NULL;

pHttpConn = pSession->GetHttpConnection(csServer, nPort);

CHttpFile *pHttpFile = NULL;

CString csFile = "/aa.txt";
pHttpFile = pHttpConn->OpenRequest(CHttpConnection::HTTP_VERB_PUT, csFile, NULL, 1, NULL, NULL, dwHttpRequestFlags);
ASSERT( pHttpFile != NULL );

CFile File;
File.Open("C:\\aa.txt", CFile::modeRead);
int nLen = File.GetLength();
char *buffer = new char[nLen];
memset(buffer, 0, nLen);
File.Read(buffer, nLen);
File.Close();

/*INTERNET_BUFFERS BufferIn;
DWORD dwBytesWritten;
BOOL bRet;
BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS ); // Must be set or error will occur
BufferIn.Next = NULL;
BufferIn.lpcszHeader = NULL;
BufferIn.dwHeadersLength = 0;
BufferIn.dwHeadersTotal = 0;
BufferIn.lpvBuffer = NULL;
BufferIn.dwBufferLength = 0;
BufferIn.dwBufferTotal = nLen; // This is the only member used other than dwStructSize
BufferIn.dwOffsetLow = 0;
BufferIn.dwOffsetHigh = 0;*/

//int res = pHttpFile->SendRequestEx(&BufferIn,NULL,HSR_INITIATE,0);
int res = pHttpFile->SendRequestEx(nLen);
if (res == 0)
MessageBox("send error.");
pHttpFile->Write(buffer, nLen);


pHttpFile->EndRequest();
pHttpFile->Close();
delete pHttpFile;
pHttpConn->Close();
delete pHttpConn;
pSession->Close();
delete pSession;

delete []buffer;
buffer = NULL;

3,248

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧