settimer in a activex dll
-
hi, how can i use SetTimer in a class, i keep getting these errors: Invalid use of adressof operator my code is: lngTimerID = SetTimer(0, 0, 200, AddressOf mysub) Public Sub mysub(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long) Dim retval As Long ' return value objWinSock.SendData ByteCode & "rcon " & rconNumber & " " & s_pass & " " & s_command objWinSock.Close Set objWinSock = Nothing retval = KillTimer(vbNull, 1) End Sub :((
-
hi, how can i use SetTimer in a class, i keep getting these errors: Invalid use of adressof operator my code is: lngTimerID = SetTimer(0, 0, 200, AddressOf mysub) Public Sub mysub(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long) Dim retval As Long ' return value objWinSock.SendData ByteCode & "rcon " & rconNumber & " " & s_pass & " " & s_command objWinSock.Close Set objWinSock = Nothing retval = KillTimer(vbNull, 1) End Sub :((
In VB6, the AddressOf operator can only be used for procedures in a module, not a class. To see how to work around the problem, look here.