資源描述:
《利用fso取得bmp,jpg,png,gif文件信息》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在應(yīng)用文檔-天天文庫。
1、利用FSO取得BMP,JPG,PNG,GIF文件信息>>教育資源庫<%’:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::’:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::’:::BMP,GIF,JPGandPNG:::’:::::::::::::::::::::::::::::::::::::::::::::::::::::::
2、::::::::::::’:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::’::::::’:::Thisfunctiongetsaspecifiednumberofbytesfromany:::’:::file,startingattheoffset(base1):::’::::::’:::Passed::::’:::flnm=>Filespecoffiletoread:::’:::offset=>Offs
3、etatanybytestoread:::’::::::’:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::functionGetBytes(flnm,offset,bytes)DimobjFSODimobjFTempDimobjTextStreamDimlngSizeonerrorresumenextSetobjFSO=CreateObject("Scripting.FileSystemObject")’First,p
4、=objFSO.GetFile(flnm)lngSize=objFTemp.SizesetobjFTemp=nothingfsoForReading=1SetobjTextStream=objFSO.OpenTextFile(flnm,fsoForReading)ifoffset>0thenstrBuff=objTextStream.Read(offset-1)endififbytes=-1then’GetAll!GetBytes=objTextStream.Read(lngSize)’ReadA
5、llelseGetBytes=objTextStream.Read(bytes)endifobjTextStream.ClosesetobjTextStream=nothingsetobjFSO=nothingendfunction’:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::’::::::’:::Functionstoconverttericvalue(long):::’:::(bothlittle-endian
6、andbig-endian):::’::::::’:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::functionlngConvert(strTemp)lngConvert=clng(asc(left(strTemp,1))+((asc(right(strTemp,1))*256)))endfunctionfunctionlngConvert2(strTemp)lngConvert2=&1234下一頁>>>>這篇文章來
7、自..,。nbsp;clng(asc(right(strTemp,1))+((asc(left(strTemp,1))*256)))endfunction’:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::’::::::’:::Thisfunctiondoesmostoftherealpt:::’:::toreadanyfile,regardlessoftheextension,andage.:::’::::::’:::
8、Passed::::’:::flnm=>Filespecoffiletoread:::’:::age:::’:::height=>heightofimage:::’:::depth=>colordepth(innumberofcolors):::’:::strImageType=>typeofimage(e.g.GIF,BMP,etc.):::’::::::’:::::::::::::::::::::::::::::