27-09-2007, 06:06 PM
I'd just like to add a little note about this tutorial, if I may.
Any variable declared of a custom Enum type will be 4 bytes.
I even made a quick test program to confirm this.
I had one form, and one module.
In the module, I had this code:
In the form, I had this code:
When I ran the program, I got a message box containing this:
I felt I needed to bring that to light since it was mentioned in the tutorial that it would make the packet ID be 1-2 bytes, but it will indeed be a full four bytes.
Of course, the way to make them 1 or 2 bytes is to have a bunch of constants set as bytes or integers. But by nature, all Enums are of data type Long.
P.S. I believe I may still have a copy of Verrigan's "binary packet" MSE where he tweaked all of the stuff. Granted, I can't check until I can get back to my computer at home.
Any variable declared of a custom Enum type will be 4 bytes.
I even made a quick test program to confirm this.
I had one form, and one module.
In the module, I had this code:
Code:
Public Enum PacketName
First = 1
Second
Third
Fourth
Fifth
Sixth
Seventh
Eighth
Ninth
Tenth
End EnumCode:
Private Sub Form_Load()
Dim myEnumVar As PacketName
myEnumVar = Fifth
MsgBox "myEnumVar: " & Str$(myEnumVar) & vbNewLine & "LenB: " & LenB(myEnumVar)
End
End SubWhen I ran the program, I got a message box containing this:
MessageBox Wrote:myEnumVar: 5
LenB: 4
I felt I needed to bring that to light since it was mentioned in the tutorial that it would make the packet ID be 1-2 bytes, but it will indeed be a full four bytes.
Of course, the way to make them 1 or 2 bytes is to have a bunch of constants set as bytes or integers. But by nature, all Enums are of data type Long.
P.S. I believe I may still have a copy of Verrigan's "binary packet" MSE where he tweaked all of the stuff. Granted, I can't check until I can get back to my computer at home.
