I have converted the code into vb.net to get width and height, but the
return value is not right.
Can anyone help me to view the code below? Thank you very much!
The SWF File Format
Specification(
http://homepages.tig.com.au/~dkl/swf/SWFfileformat.html)
My vb.net code
*************** *************** *************** *************** **
Public Class SWFInfo
Private header As String
Private RECTdata As String
Private nBits As String
Private mxMin As Int32
Private mxMax As Int32
Private myMin As Int32
Private myMax As Int32
Private mheigt as Int32
Private mwidth As Int32
Public ReadOnly Property Width()
Get
Return mwidth
End Get
End Property
Public ReadOnly Property Height()
Get
Return mheigt
End Get
End Property
Public Function ReadHeader(ByVa l fileName)
Const ForReading As Short = 1
Const ForWriting As Short = 2
Const ForAppending As Short = 8
Dim fso, f As Object
fso = CreateObject("S cripting.FileSy stemObject")
f = fso.OpenTextFil e(fileName, ForReading)
header = f.Read(21)
RECTdata = DecToBin(Asc(Mi d(header, 9, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 10, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 11, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 12, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 13, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 14, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 15, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 16, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 17, 1)), 8)
nBits = Mid(RECTdata, 1, 5)
nBits = BinToDec(nBits)
mxMin = BinToDec(Mid(RE CTdata, 6, nBits))
mxMax = BinToDec(Mid(RE CTdata, 6 + nBits * 1, nBits))
myMin = BinToDec(Mid(RE CTdata, 6 + nBits * 2, nBits))
myMax = BinToDec(Mid(RE CTdata, 6 + nBits * 3, nBits))
mheigt = CInt((myMax - myMin) / 20)
mwidth = CInt((mxMax - mxMin) / 20)
End Function
Private Function DecToBin(ByRef inNumber As Object, ByRef OutLenStr
As Object) As String
Dim binary As String
Do While inNumber >= 1
binary = binary & inNumber Mod 2
inNumber = inNumber \ 2
Loop
binary = binary & New String("0", OutLenStr - Len(binary))
Return StrReverse(bina ry)
End Function
Private Function BinToDec(ByRef inBin As Object) As Int32
Dim counter As Int32
Dim temp As Int32
Dim Value As Int32
inBin = StrReverse(inBi n)
temp = 0
For counter = 1 To Len(inBin)
If counter = 1 Then
Value = 1
Else
Value = Value * 2
End If
temp = temp + CDbl(Mid(inBin, counter, 1)) * Value
Next
Return temp
End Function
End Class
"yxq" <ga***@163.ne t> дÈëÏûÏ¢ÐÂÎÅ:%2 *************** *@TK2MSFTNGP11. phx.gbl...
I found a link
http://www.4guysfromrolla.com/webtec...102001-1.shtml
But the code will not work on vb6.0
"yxq" <ga***@163.ne t> дÈëÏûÏ¢ÐÂÎÅ:OT **************@ TK2MSFTNGP10.ph x.gbl... Hello,
I use the com component "shockwave flash object" to play flash file, but
how to get the actual size (width*height) of flash file but no control
size? thank you!