The thing is, that pretty much IS the code causing the problem.
CODE
Public Function mouseOver(Button As Integer, x As Integer, y As Integer) As Long
Dim mID As Integer, iID As Integer, oID As Integer
Dim yp As Integer, j As Integer
Dim t As Long
'FIRST CHUNK OF CODE
If x >= mvarvduXPos And x <= mvarvduXPos + mvarvduWidth And y >= mvarvduYPos And y <= mvarvduYPos + mvarvduHeight Then
mID = mvarmchID
End If
'SECOND CHUNK OF CODE
If mvarmchNumIns > 0 Then
For j = 1 To mvarmchNumIns
yp = (mvarvduHeight / (mvarmchNumIns + 1)) * j
If x >= mvarvduXPos + 3 And x <= mvarvduXPos + 9 And y >= mvarvduYPos + yp - 3 And y <= mvarvduYPos + yp + 3 Then
iID = j
End If
Next
End If
'THIRD CHUNK OF CODE
If mvarmchNumOuts > 0 Then
For j = 1 To mvarmchNumOuts
yp = (mvarvduHeight / (mvarmchNumOuts + 1)) * j
If x >= mvarvduXPos + mvarvduWidth - 9 And x <= mvarvduXPos + mvarvduWidth - 3 And y >= mvarvduYPos + yp - 3 And y <= mvarvduYPos + yp + 3 Then
oID = j
End If
Next
End If
'HERE IS THE PROBLEM
t = (mID * 10000) + (oID * 100) + (iID)
mouseOver = t
End Function
Ok what's happening is this...
First chunk of code returns the Machine ID that the mouse is hovering over.
Second chunk of code returns the Input Nub ID of the relevant machine (0 if not over nub)
Third chunk of code return the Output Nub ID...
Essentially the function returns a long integer which has encoded in it all three bits of mouse-over info.
Say the mouse is over machine 4 (the one with the problem) and also over input nub 3, the result should look like this -> 40300
40300 is a number that should never cause a long integer to overflow. A normal integer yes. But not a long one!
2,147,483,647
Cheers
This post has been edited by Arblique: 31 Aug, 2008 - 07:02 AM