[VB6] Need help with runtime error!

Newbie Spellweaver
Joined
Oct 17, 2005
Messages
11
Reaction score
0
Alright well I've been making this online rpg, created a server and a client everything is working 100% on my computer and another a few of my friends too! BUT I've sent the game to some people and they say they are getting runtime error '5'. This error is described as an "invalid procedure or call." Now clearly this is because of a missing reference or a file I didn't include with the client but can someone help me figure out what is missing to cause this error?

If you think you would be able to give me a hand add me to MSN: [email protected] or just reply here.. Thanks
 
If you want to get to the exact bit of the offending code, then put error handlers everywhere -- and differentiate them. Not only will this help you in a situation like this, but it will also help you in the future if you want to pinpoint errors when making updates.
Code:
On Error GoTo iLoveDK


end
iLoveDK:
MsgBox Err.Description, vbCritical, "<UNIQUE INTEGER HERE>" & Err.Number

Obviously the "<UNIQUE INTEGER HERE>" part of the code would be replaced with an integer of your choice. It isn't neccessary to use either, but I find it helps when finding specific pieces of code since many people are just terrible at describing how to reproduce their situation (unless they're just opening the file, boom boom). I'm assuming you know how to use error handlers btw, but if you don't just let me know and I'll expand on it.
 
Alright I sent the source to someone who was getting the error and they told me that it was in this part of the code:

Code:
Public Function recvPck(pckDat As String)
    If Left$(pckDat, 2) <> Chr(164) & "U" Then
        MsgBox "Packet error!", "Error"
        Exit Function
    End If
    Dim header As String, time As String, sSize As String, cSize As String
    Dim subject As String, content As String
    Dim read As Double
    header = Left$(pckDat, 2)
    read = 2
    time = Right$(Left$(pckDat, 4 + read), 4)
    read = read + 4
    sSize = getFourByteLen(Right$(Left$(pckDat, 4 + read), 4))
    read = read + 4
    subject = Right$(Left$(pckDat, sSize + read), sSize)
    read = read + sSize
    cSize = getFourByteLen(Right$(Left$(pckDat, 4 + read), 4))
    read = read + 4
    content = Right$(Left$(pckDat, cSize + read), cSize)
    read = read + cSize
    newPckDat = Right$(pckDat, (Len(pckDat) - read))
    pckDat = CStr(newPckDat)
    'If Len(pckDat) <> 0 Then
        'recvPck (pckDat)
    'End If
    incomingMessage decryptString(time, encKey), decryptString(subject, encKey), decryptString(content, encKey)
End Function

Specifically on line:

Code:
newPckDat = Right$(pckDat, (Len(pckDat) - read))

But I don't see a problem with that line? WTF? runtime error '5' is invalid procedure or argument? I'm assuming that it would be because of an invalid function im using or parameter I'm passing into it? But it only errorrs on that line? the right$() and len() functions are used in other places and dont error? :S and the variables I'm passing into them are all valid so I'm lost...

And it's gunna be kinda hard to pinpoint the error that way because I actually dont get any errors on my computer, it's only on some peoples computers SO what I need to be determining is, What do I have that they dont? and How can I impliment it on their computer?
 
Is newPckDat defined elsewhere? What type of variable is it? Is there specific data that's causing the crash or does it crash just in general?

If you think it's that piece, you should make a mock project that does nothing except for use a line like (while feeding data to it of course). Without seeing the rest of the project, there isn't much I can do.

I'd still implement error handling though.
 
AH I figured it out!!!! When the packets are sent some have too much data and are broken into 2 or 3 etcetc... So basically my cSize (Content size) would say like 2900b and there wuold only be like 1000b left in the packet so it would try to read beyond the packet and error... Runtime '5' though makes no sense, usually it would be an overflow error? :S Anyways, I basically did a While len(pckDat) <> the size specified DoEvents, so itll do events until the rest of the packet comes in before processing it :P
 
Back