docin转swf(vc源码)修正,更新下载!
来源:互联网 发布:linux qt多进程 编辑:程序博客网 时间:2024/03/28 16:30
(已修改,成功,下载已更新)
从docin转换为swf文件
由于docin文件有2种格式,特制作2个版本。
http://download.csdn.net/source/2492344
版本一(已修改,成功,下载更新)
#include "zlib.h"
#pragma comment(lib,"zlib.lib")
void CDocinDlg::OnButton2()
{
// TODO: Add your control notification handler code here
CFile mFile("c://docin_1512171.docin",CFile::modeRead);
int pageWidth,pageHeight,totalPages,headerLength;
if(mFile.GetLength()<2) return;
mFile.SeekToBegin();
mFile.Read(&pageWidth,4);
mFile.Read(&pageHeight,4);
mFile.Read(&totalPages,4);
mFile.Read(&headerLength,4);
BYTE *com=new BYTE[headerLength];
mFile.Read(com,headerLength);
unsigned long headerUncompressLength;
BYTE *headerArray=new BYTE[headerLength*10];
uncompress(headerArray,&headerUncompressLength,com,headerLength);
for(int i=0;i<totalPages&&i<50;i++)
{
int bodyLen=0;
mFile.Read(&bodyLen,4);
BYTE *bodytmp=new BYTE[bodyLen];
mFile.Read(bodytmp,bodyLen);
unsigned long bodyUncompressLen=bodyLen*10;
BYTE *bodyArrary=new BYTE[bodyUncompressLen];
uncompress(bodyArrary,&bodyUncompressLen,bodytmp,bodyLen);
int lengh=0;
CString ss;
lengh=headerUncompressLength+bodyUncompressLen+8;
ss.Format("%d",lengh);
// AfxMessageBox(ss);
/*
BYTE littleHeaderArray[]={70,87,83,9,0,0,0,0};
littleHeaderArray[4]=lengh%256;
littleHeaderArray[5]=lengh/256%256;
littleHeaderArray[6]=lengh/256/256%256;
littleHeaderArray[7]=lengh/256/256/256;
*/
int littleHeaderArray[]={156456774,lengh};
CString swfname;
swfname.Format("c://%d_%d.swf",totalPages,i+1);
CFile mFile2(swfname, CFile::modeWrite|CFile::modeCreate);
mFile2.Write(littleHeaderArray,8);
mFile2.Write(headerArray,headerUncompressLength);
mFile2.Write(bodyArrary,bodyUncompressLen);
mFile2.Flush();
mFile2.Close();
}
mFile.Close(); //mFile2.Write(hchar,q-1);
//
//
//
AfxMessageBox("转换完成");
}
版本二
void CDocin2Dlg::OnBUTTONin()
{
// TODO: Add your control notification handler code here
CString filter="输入文件(.docin)|*.docin||";
CFileDialog mydialog(TRUE,0,0, OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY, filter);
if(mydialog.DoModal()==IDOK)
{
m_infile=mydialog.GetPathName();
UpdateData(FALSE);
}
}
void CDocin2Dlg::OnBUTTONout()
{
// TODO: Add your control notification handler code here
BROWSEINFO bf;
LPITEMIDLIST lpitem;
memset(&bf,0,sizeof BROWSEINFO);
bf.lpszTitle="选择保存swf文件的文件夹";
bf.ulFlags = BIF_STATUSTEXT|0x0040 |BIF_RETURNONLYFSDIRS|BIF_EDITBOX;//| BIF_BROWSEINCLUDEFILES;
lpitem=SHBrowseForFolder(&bf);
char pBuffer[MAX_PATH];
SHGetPathFromIDList(lpitem,pBuffer);
m_outfile=pBuffer;
UpdateData(FALSE);
}
//引入XML
#import "MSXML.DLL" named_guids
//引用命名空间
using namespace MSXML;
void CDocin2Dlg::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
if(m_infile=="")
{
AfxMessageBox("请先选择要转换的docin文件!");
return;
}
if(m_outfile=="")
{
AfxMessageBox("请选择保存位置!");
return;
}
WinExec("cmd.exe /c md /""+m_outfile+"/"", SW_HIDE);//必须加参数/c
Sleep(100);
CFile mFile(m_infile,CFile::modeRead);
unsigned char b0,b1,b2,b3;
if(mFile.GetLength()<2) return;
mFile.SeekToBegin();
mFile.Read(&b0,1);
mFile.Read(&b1,1);
mFile.Read(&b2,1);
mFile.Read(&b3,1);
int headerLen=b0+(b1<<8)+(b2<<18)+(b3<<24);
BYTE *headertmp=new BYTE[headerLen];
mFile.Read(headertmp,headerLen);
CString xmldescriptionStr="";
int aa=0;
while(aa<headerLen)
{
xmldescriptionStr+=headertmp[aa]-99;
aa++;
}
//AfxMessageBox(xmldescriptionStr);
CString xmlname="xmldescriptionStr.xml";
CFile xmlFile(xmlname, CFile::modeWrite|CFile::modeCreate);
xmlFile.Write(xmldescriptionStr,headerLen);
xmlFile.Close();
//初始化com环境
CoInitialize(NULL);
IXMLDOMDocumentPtr pXmlDoc;
HRESULT hr;
hr = pXmlDoc.CreateInstance(MSXML::CLSID_DOMDocument);
if (FAILED(hr))
{
AfxMessageBox(_T("无法创建Xml对象实例。"));
return ;
}
if(!pXmlDoc->load((LPCTSTR)xmlname) )
{
AfxMessageBox(_T("无法加载Xml文件。"));
return ;
}
//获取Xml文件首个元素
IXMLDOMElementPtr pRoot = pXmlDoc->GetdocumentElement();
if(pRoot != NULL)
{
//获取所有的子节点
IXMLDOMNodeListPtr pNodes = pRoot->GetchildNodes();
int totalPages=pNodes->Getlength();
for(int i=0; i<totalPages; i++)
{
_bstr_t textaa=pNodes->nextNode()->attributes->item[0]->text;
int ii=atoi(textaa);
//CString ss;
//ss.Format("%d",ii);
// AfxMessageBox(ss);
BYTE *bodytmp=new BYTE[ii];
mFile.Read(bodytmp,ii);
CString swfname;
swfname.Format(m_outfile+"//"+m_rename+"(%d_%d).swf",totalPages,i+1);
CFile mFile2(swfname, CFile::modeWrite|CFile::modeCreate);
mFile2.Write(bodytmp,ii);
mFile2.Close();
}
}
mFile.Close();
AfxMessageBox("转换完成");
WinExec("explorer.exe /""+m_outfile+"/"", SW_SHOWNORMAL); //速度快
// CDialog::OnOK();
}
- docin转swf(vc源码)修正,更新下载!
- 豆丁网缓存docin离线浏览(提供源码)修改,已更新
- docin
- 中体时时彩平台源码(修正版)纯源码完整可用下载
- VC++/MFC 源码下载
- 源码下载地址(不定时更新)
- VC++网上下载HTML源码
- 【持续更新】标准源码下载
- struts2 文件下载(修正中文问题)
- 【转自koma】 VC无进程木马下载器源码
- php在线压缩解压缩SWF文件-修正
- Android 开发即时聊天工具 YQ 《更新》(源码下载)
- 下载和编译Android源码问题集(持续更新)
- 如何下载破解SWF
- 如何下载.swf文件
- Android转React native代码转换(持续更新,欢迎帮助修正...)
- VC无进程木马下载器源码
- 穿越下载者VC源码 全文
- json.org例子
- xml operation
- 太 他 吗 的经典了!乐了您就顶一个!
- 关于验证码的问题
- (转)2010强暴开场
- docin转swf(vc源码)修正,更新下载!
- 美国官司专业户再次出手 国内大小网站噤若寒蝉
- 八种方法排除网络连接故障
- UNIX Domain Sockets
- Java取时间(12小时制和24小时制)
- 深入了解字符集和编码(转)
- MySQL表损坏预防与修复
- 系统设计-B/S结构和C/S结构
- 进来笑笑。。。。