VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

UDT Calculator

Pascal vd Heiden  (1 Submission)   Data Structures   Visual Basic 3.0   Intermediate   Wed 3rd February 2021

Calculates the length of a UDT (User Defined Type) required to store it in a String using CopyMemory, MoveMemory or any simular API. (So you can easily save it or transfer it over Internet.) NEVER use Len() or LenB() for this, they both return the incorrect length. (Len often returns less bytes, LenB often returns way more)
 




The code of this application is not impressive at all. The thing is, no-one ever seemed to have found a way to get the exact string length to store a UDT in, until now :D




Usage: Just add the types with their sizes to the list in the same order as your UDT is and the length is displayed below in a textbox.




Note: I will work on a UDT Calculator that can analyze your code pasted in a textbox later.




You vote would be nice, but never mind if you're short on time :P

Inputs
UDT User Defined Type String Len LenB Length CopyMemory MoveMemory

Assumes
Know how to use CopyMemory/MoveMemory and UDT's.

Returns
UDT String Len LenB Length

Side Effects
It may not be correct for VB4 and older, or .NET. Only tested for VB5 and VB6.

Rate UDT Calculator (7(7 Vote))

Download UDT Calculator

UDT Calculator Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters