DYNAMIC
variable
should I use dynamic variable? Dynamic Variable is a DLL that makes data storage simple. My DLL makes storing information that uses various data types (e.g. string, boolean, long, or double). If all you want is to create a file that only uses strings (e.g. a playlist), don't use this program. It will take up space and save you only a little time. Also don't use this program if you want the user of your program to be able to edit the files your program will spit out with notepad, because they'll just get garbage if you use this. This DLL is meant for people who want to create a program that saves files in the same way that Microsoft Word might. Maybe each document will have its own settings, etc. In general Dynamic Variable is used in advanced programs that require binary input and output. what are the elements of dynamic variable? Dynamic Variable has very few elements (i.e. methods, properties) and so functions similarly to a collection.
|
||||||||||||||||||||||
how does it work? Dynamic Variable uses the built in Get and Put statements and uses the Binary file mode. It does not lock the file for reading or writing. The most important setting is the AutoDetectVars boolean. A file saved using this will not open correctly when AutoDetectVars is false and vice-versa. When this is used an integer representing the type of a variable will precede it in the file. For example, here is what a segment in a file might look like (where d is a descriptor byte, and v is variable data): ddvvvvvvvvddvvddvvvvddvvvvvvvvvvvvvvvvvvvvvvvvvvddvvvv It causes the file to be slightly longer, but it allows you to not initialize the variables in every instance of a DynamicVar class. This could be useful especially if you want to use Dynamic Variable for an option file. Instead of using the registry (which is not well supported in Visual Basic anyway) just write it to the disk. There are two arrays in my DLL, one a variant array and the other a vbVarType array. As a result the program does not make sure what you tell it one of the variables should be is the type that it is set for. It trusts that you can make sure that won't happen. Strings are a special case in this DLL. Because strings don't have a fixed memory length like a Long (4 bytes) or an Integer (2 bytes) the program has to write an integer value before the string specifying the length of the string. So using this with the last example, storing "they might be giants" to disk would look like this (where d is a descriptor byte, l is a length byte, and the rest is data): ddllthey might be giantsddllthe matrix soundtrackddllriverdance That's about all. Thank you for using Dynamic Variable. Please sent comments to Brian Donovan at maybeyoureinsane@hotmail.com. |