VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



UDT Calculator

by Pascal vd Heiden (1 Submission)
Category: Data Structures
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (6 Votes)

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.
Code 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

Download UDT Calculator

Download UDT Calculator (4 KB)

UDT Calculator Comments

No comments have been posted about UDT Calculator. Why not be the first to post a comment about UDT Calculator.

Post your comment

Subject:
Message:
0/1000 characters