From: LondonLad on


"Karl E. Peterson" wrote:

> LondonLad wrote:
> > Hi
> > All of the variables are long no integer's.
> > I can only get help here if I post the code as the program is beyond my VB
> > knowledge level.
> > But the problem I have is the code is not mine if S McMahon reads this forum
> > can I have permission to post part of his code?
>
> Obviously, no one here can give you permission to post someone else's
> work. But, I'd have to think that if you were able to isolate the
> problem to just where it is, and not bring in lots of unrelated stuff,
> there wouldn't be any problem at all.
>
> First, off, nail the problem line of code. The one where the error
> occurs. Then prepare to explain what each variable in that line of
> code is. (If you put the cursor on them, and press Shift-F2, you'll
> find their definition.)
>
> That oughta get us going.
>
> --
> ..NET: It's About Trust!
> http://vfred.mvps.org
>

This is S McMahon code in which I have the overload error

Private Sub pUpdateTag()
Dim lErr As Long
Dim sErr As String

On Error GoTo errorHandler
' create a byte array containing the information
' we want to write out:
Dim b() As Byte

' Write header:
ReDim b(0 To 11) As Byte
b(0) = Asc("I")
b(1) = Asc("D")
b(2) = Asc("3")
b(3) = 3
Dim lSize As Long
lSize = 10

' start writing:
Dim sFrame As String
Dim iTagCount As Long
Dim k As Long
For k = 1 To m_cFrame.Count
sFrame = m_cFrame.Item(k)
If InStr(sFrame, "ID3") = 0 Then
iTagCount = m_cFrameItems(sFrame)
If (iTagCount > 0) Then
Dim i As Long, j As Long
Dim sTag As String
Dim lTagLen As Long
Dim bTag() As Byte
For i = 1 To iTagCount
' how long is the tag?
sTag = m_cTag(sFrame & ":" & i)
sTag = vbNullChar & sTag
lTagLen = Len(sTag)
ReDim Preserve b(0 To lSize + lTagLen + 12 - 1) As Byte
' write the frame:
b(lSize) = Asc(Mid(sFrame, 1, 1))
b(lSize + 1) = Asc(Mid(sFrame, 2, 1))
b(lSize + 2) = Asc(Mid(sFrame, 3, 1))
b(lSize + 3) = Asc(Mid(sFrame, 4, 1))
' write the size:
setSize b, lSize + 4, lTagLen

' write the tag:
bTag = StrConv(sTag, vbFromUnicode)
For j = LBound(bTag) To UBound(bTag)
b(lSize + 10 + j) = bTag(j)
Next j

' prepare for the next one:
lSize = lSize + lTagLen + 10
Next i
End If
End If
Next k
lSize = lSize + 4
ReDim Preserve b(0 To lSize - 1) As Byte

' Correct header size:
setSize b, 6, lSize


' Now check if we have sufficient space to write the
' ID3v2 header to the file:
Dim iFile As Long 'Integer
iFile = FreeFile

On Error Resume Next
Open m_sMp3File For Binary Access Read Write Lock Write As #iFile
If (Err.Number <> 0) Then
lErr = Err.Number
sErr = Err.Description
On Error GoTo 0
Err.Raise lErr, App.EXEName & ".cMP3ID3v2", sErr
Else

On Error GoTo errorHandler

Dim iPos As Long
Dim bVer As Byte
iPos = findID3Pos(iFile)
If (iPos > 0) Then

Seek #iFile, iPos

' find the available space to write into:
Get #iFile, , bVer
Get #iFile, , bVer
Get #iFile, , bVer
Dim lTagLenFile As Long
Dim lTagBlockLen As Long
Get #iFile, , lTagLenFile
lTagBlockLen = getSize(lTagLenFile)

then next line is where I get the error
the values are
lSize = 1980695040
TagBlockLen = 133050

If (lSize < lTagBlockLen) Then
' we can overwrite the existing ID3 tag
setSize b, 6, lTagBlockLen

Seek #iFile, iPos - 3
Put #iFile, , b

Else
' we need to allocate space for this ID3 tag:
Dim lNewTagSpace As Long
lNewTagSpace = ((lSize \ 2048) + 1) * 2048
setSize b, 6, lNewTagSpace

iFile = copyFileShift(iFile, lNewTagSpace - lTagBlockLen)
If Not (iFile = 0) Then
Seek #iFile, 1
Put #iFile, , b
End If

End If
Else
' we to create a new ID3 tag:
lNewTagSpace = ((lSize \ 2048) + 1) * 2048
setSize b, 6, lNewTagSpace

' take everything from the start to then end
' and put it at position lNewTagSpace along:
iFile = copyFileShift(iFile, lNewTagSpace)
If Not (iFile = 0) Then
Seek #iFile, 1
Put #iFile, , b
End If

End If


End If
On Error Resume Next
Close #iFile
On Error GoTo 0
Exit Sub

errorHandler:
' out of memory, can't read or write files, out of disk space
' etc
lErr = Err.Number
sErr = Err.Description
On Error Resume Next
Close #iFile
On Error GoTo 0
Err.Raise lErr, App.EXEName & ".cMP3ID3v2", sErr
Exit Sub

End Sub

Hope you can help
From: Dee Earley on
On 20/05/2010 09:54, LondonLad wrote:
> the values are
> lSize = 1980695040

Do you really have a 1.9GB MP3??

--
Dee Earley (dee.earley(a)icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
From: David Kaye on
"Mike Williams" <Mike(a)WhiskeyAndCoke.com> wrote:

>If you lost a phone in a bar and you discovered who had found it, do you
>think you would be able to persuade a police SWAT team to "gangster up" and
>break down his door with a battering ram in the middle of the night and take
>away his personal possessions! Sheesh!

I agree that Apple overstepped its bounds, and I'm surprised that they were
able to bring down the heavy hand of the law on anyone for this.

>I'm also arguing that large corporations, such as Micro$oft for example,
>should not use heavy handed tactics against people who they believe have
>wronged them in some way whilst at the same time they themselves employ
>illegal gangster like tactics in their own pursuit of power and profit:

Sorry, I think of Microsoft in godlike terms. I don't put them in the same
Antichrist league as Google or Apple. I think MS has done way more good than
bad. I'm also not convinced that MS has used any "gangster-like tactics" at
any time. I happen to agree with them about the software piracy problem. It
appears that about 1/3 of all Windows OS copies worldwide are fraudulent.

That said, I wish they'd make it easier for me to reinstall Windows in
customer machines when I have to replace hard drives or there is severe
corruption involving the drive. Few of my customers can locate their copy of
Windows -- assuming that the computer maker has even included a copy with the
computer! I think MS should require their resellers to package a real Windows
disk with each machine.

From: Mike Williams on
"David Kaye" <sfdavidkaye2(a)yahoo.com> wrote in message
news:ht367r$gpp$2(a)news.eternal-september.org...

> Sorry, I think of Microsoft in godlike terms.

In that case there doesn't seem to be much point in any further attempts to
persuade you to discuss things in a rational manner, since you appear to be
an irrational being.

> I'm also not convinced that MS has used any
> "gangster-like tactics" at any time. I happen
> to agree with them about the software piracy
> problem.

Your totally irrational attempt to link Micro$oft's disgraceful behaviour in
Africa (as mentioned at the link I posted) with their views about software
piracy merely reinforces my aforementioned view that you are an irrational
being. In the report at the link I posted it is quite clear that Micro$oft
and its agents were the pirates, not anybody else. The government of an
African country had closed a deal with Mandriva for the purchase and
installation of 17,000 specially customised Linux operating systems for the
country's schools and Micro$oft's gangsters secretly persuaded the IT
company who were carrying out the work for the government to pay Mandriva
using the government's money for the Linux systems, in order that Mandriva
would not become suspicious, and to then dishonestly and illegally
immediately ditch those Linux systems, against the wishes of the purchaser,
and instead install 17,000 copies of Micro$oft Windows XP which just
happened to be floating around and which the customer did not want! And all
this to gain an illegal foothold in what is perceived to be an emerging
market. Apparently a bribe of just under half a million US dollars was
involved!

Mike





From: C. Kevin Provance on
.. lSize = 1980695040
.. TagBlockLen = 133050

And you wonder why you are getting an overflow error?

If you are not going to try and write your own code, I would start searching for a better example to rip off.



"LondonLad" <LondonLad(a)discussions.microsoft.com> wrote in message news:D6EEFD24-9451-4A41-BFA9-9EDC2231A5D5(a)microsoft.com...
:
:
: "Karl E. Peterson" wrote:
:
: > LondonLad wrote:
: > > Hi
: > > All of the variables are long no integer's.
: > > I can only get help here if I post the code as the program is beyond my VB
: > > knowledge level.
: > > But the problem I have is the code is not mine if S McMahon reads this forum
: > > can I have permission to post part of his code?
: >
: > Obviously, no one here can give you permission to post someone else's
: > work. But, I'd have to think that if you were able to isolate the
: > problem to just where it is, and not bring in lots of unrelated stuff,
: > there wouldn't be any problem at all.
: >
: > First, off, nail the problem line of code. The one where the error
: > occurs. Then prepare to explain what each variable in that line of
: > code is. (If you put the cursor on them, and press Shift-F2, you'll
: > find their definition.)
: >
: > That oughta get us going.
: >
: > --
: > ..NET: It's About Trust!
: > http://vfred.mvps.org
: >
:
: This is S McMahon code in which I have the overload error
:
: Private Sub pUpdateTag()
: Dim lErr As Long
: Dim sErr As String
:
: On Error GoTo errorHandler
: ' create a byte array containing the information
: ' we want to write out:
: Dim b() As Byte
:
: ' Write header:
: ReDim b(0 To 11) As Byte
: b(0) = Asc("I")
: b(1) = Asc("D")
: b(2) = Asc("3")
: b(3) = 3
: Dim lSize As Long
: lSize = 10
:
: ' start writing:
: Dim sFrame As String
: Dim iTagCount As Long
: Dim k As Long
: For k = 1 To m_cFrame.Count
: sFrame = m_cFrame.Item(k)
: If InStr(sFrame, "ID3") = 0 Then
: iTagCount = m_cFrameItems(sFrame)
: If (iTagCount > 0) Then
: Dim i As Long, j As Long
: Dim sTag As String
: Dim lTagLen As Long
: Dim bTag() As Byte
: For i = 1 To iTagCount
: ' how long is the tag?
: sTag = m_cTag(sFrame & ":" & i)
: sTag = vbNullChar & sTag
: lTagLen = Len(sTag)
: ReDim Preserve b(0 To lSize + lTagLen + 12 - 1) As Byte
: ' write the frame:
: b(lSize) = Asc(Mid(sFrame, 1, 1))
: b(lSize + 1) = Asc(Mid(sFrame, 2, 1))
: b(lSize + 2) = Asc(Mid(sFrame, 3, 1))
: b(lSize + 3) = Asc(Mid(sFrame, 4, 1))
: ' write the size:
: setSize b, lSize + 4, lTagLen
:
: ' write the tag:
: bTag = StrConv(sTag, vbFromUnicode)
: For j = LBound(bTag) To UBound(bTag)
: b(lSize + 10 + j) = bTag(j)
: Next j
:
: ' prepare for the next one:
: lSize = lSize + lTagLen + 10
: Next i
: End If
: End If
: Next k
: lSize = lSize + 4
: ReDim Preserve b(0 To lSize - 1) As Byte
:
: ' Correct header size:
: setSize b, 6, lSize
:
:
: ' Now check if we have sufficient space to write the
: ' ID3v2 header to the file:
: Dim iFile As Long 'Integer
: iFile = FreeFile
:
: On Error Resume Next
: Open m_sMp3File For Binary Access Read Write Lock Write As #iFile
: If (Err.Number <> 0) Then
: lErr = Err.Number
: sErr = Err.Description
: On Error GoTo 0
: Err.Raise lErr, App.EXEName & ".cMP3ID3v2", sErr
: Else
:
: On Error GoTo errorHandler
:
: Dim iPos As Long
: Dim bVer As Byte
: iPos = findID3Pos(iFile)
: If (iPos > 0) Then
:
: Seek #iFile, iPos
:
: ' find the available space to write into:
: Get #iFile, , bVer
: Get #iFile, , bVer
: Get #iFile, , bVer
: Dim lTagLenFile As Long
: Dim lTagBlockLen As Long
: Get #iFile, , lTagLenFile
: lTagBlockLen = getSize(lTagLenFile)
:
: then next line is where I get the error
: the values are
: lSize = 1980695040
: TagBlockLen = 133050
:
: If (lSize < lTagBlockLen) Then
: ' we can overwrite the existing ID3 tag
: setSize b, 6, lTagBlockLen
:
: Seek #iFile, iPos - 3
: Put #iFile, , b
:
: Else
: ' we need to allocate space for this ID3 tag:
: Dim lNewTagSpace As Long
: lNewTagSpace = ((lSize \ 2048) + 1) * 2048
: setSize b, 6, lNewTagSpace
:
: iFile = copyFileShift(iFile, lNewTagSpace - lTagBlockLen)
: If Not (iFile = 0) Then
: Seek #iFile, 1
: Put #iFile, , b
: End If
:
: End If
: Else
: ' we to create a new ID3 tag:
: lNewTagSpace = ((lSize \ 2048) + 1) * 2048
: setSize b, 6, lNewTagSpace
:
: ' take everything from the start to then end
: ' and put it at position lNewTagSpace along:
: iFile = copyFileShift(iFile, lNewTagSpace)
: If Not (iFile = 0) Then
: Seek #iFile, 1
: Put #iFile, , b
: End If
:
: End If
:
:
: End If
: On Error Resume Next
: Close #iFile
: On Error GoTo 0
: Exit Sub
:
: errorHandler:
: ' out of memory, can't read or write files, out of disk space
: ' etc
: lErr = Err.Number
: sErr = Err.Description
: On Error Resume Next
: Close #iFile
: On Error GoTo 0
: Err.Raise lErr, App.EXEName & ".cMP3ID3v2", sErr
: Exit Sub
:
: End Sub
:
: Hope you can help