EXE 到 SWF 文件的轉換代碼
//-------------------------------------------------------------
/* Exe 格式 到 SWF 各式轉換程序
支持Flash6格式
源碼很容易看懂!
有問題來信live_on@sohu.com
狹路相逢 這個函數是我的Live Flash 播放器的一部分 下載請到 http://www.2ccc.com/softf/2111_livefla.zip
呵呵,宣傳而已:-)
*/
#include
#pragma hdrstop #include "exef.h" //------------------------------------------------------------- #pragma package(smart_init)
AnsiString exe2swf(AnsiString FileName) //函數名
{
int iFileHandle;
unsigned long iFileLength;
unsigned long iBytesRead;
AnsiString dFileName;
unsigned char *pszBuffer;
//unsigned char *Buffer; iFileHandle = FileOpen(FileName.c_str(), fmOpenRead);//打開文件
iFileLength = FileSeek(iFileHandle,0,2);//確定長度
FileSeek(iFileHandle,0,0);
pszBuffer = new char[iFileLength 1]; //讀入源文件
if (pszBuffer==NULL)
{
return(NULL);
}
iBytesRead = FileRead(iFileHandle, pszBuffer, iFileLength);
FileClose(iFileHandle);//關閉
//dFileName=
dFileName=FileName.UpperCase ().SubString (1,FileName.Length () - 4) ".SWF" ;//生成目標文件名
// if (FileExists(dFileName)) //確定是否存在
// return (NULL);
//printf("%d \n",iBytesRead);
int i=0; int ii=0;
for (i=0 ;iMessageBoxA("文件格式異常!強制播放?","警告",IDOK))
return (NULL);
} FileWrite(iFileHandle, pszBuffer,iFileLength-i );
FileClose(iFileHandle); delete [] pszBuffer;
return(dFileName);
}
網路志
工聯盟----Visita網站
http://www.vista.org.tw
---[ 發問前請先找找舊文章 ]---