VBCorLib for VB6

Monday, June 27, 2005

Stabilized...

Ok, I admit that Version 1.0 was not completely stable in some areas and even some functions failed. Even with a 1000+ tests, I can still miss stuff.

I improved many things in Version 1.2.2, and now I'm at Version 1.5. Many things have been fixed and improved again. A much more coherent set of interfaces have been implemented and some unstable portions of code have been fixed.

The WeakReference has been fixed and now works fine in the IDE and compiled dll. I use it extensively in the exception classes.

I created an ExceptionBase class that maintains a weak reference to the parent exception class. It provides services to easily implement exception classes, including holding any values needed and is persistable.

Much refactoring has happened which actually shrank the size of the dll. Not by much, but it was something.

I don't think I will be adding anything, really. I'm pretty sure this is the end at 1.5. I'll prepare it for release as soon as I can.

- Kelly

Friday, June 24, 2005

I Hate It When...

I hate it when someone accuses me of just "ripping" or "stealing" the code right from the mscorlib.dll library using something like Reflector or the SSCLI. I have had to deal with several people like this and when I ask them to provide examples of the ripped code they seem to disappear.

Now someone one Planet Source Code has accused me of the same thing with the same claims. I've asked him for examples and told him about the ECMA-335 standard, ISO standard, and reminded him about the MSDN. I then pointed him to the Mono Project and DotGNU Protable .NET project. We'll see what he comes up with.

Oh, and new HD, everything is saved, hurray!

- Kelly

Wednesday, June 22, 2005

Bad Day - But Getting Better

Lots going on...

Of course it would happen while I'm hammering out code. My laptop drive decided it was going to have a heat releated problem. I spent an evening (until 6am) diagnosing the problem. Nothing like getting core dumps in the middle of work. I couldn't believe it, the harddrive actually would fail after running for a few minute. I varified the harddrive was the culprit by replacing it with a cheap-o drive. Everything worked perfectly.

So now I've been salvaging the files in small chunks between cooldown periods for the drive. So I've had an adventure. New drive ordered!

So anyways, VBCorLib has had some major changes that will make it incompatible with the currently available version. The single most impactful change is the interface name of cObject to IObject. Some function signatures have been extended to give more benifit. Internally, the error handling has been updated to be more robust, especially with optional arguments. Most of the optional arguments have been converted to a Variant to help with the robustness.

I've added some functions to classes, such as an AppendQuick function for the StringBuilder that is optimized for pure speed. Also, a NewArray function was added to the public functions so the cArray object does not need to be referenced.

I'm looking into how to create a resource writer for the .RES files. And I'm considering adding multi-threading into the mix. Documentation is being updated aswell.

So, there are lots of changes that are being made. This is basically the final stages of the library. This will probably be released as a version 1.5, since so many things will have changed.

Working hard,
- Kelly

Thursday, June 16, 2005

Registry and Console

Ok, the RegistryKey was not capable of getting or setting values as an empty byte array or string array. This has been corrected and will be available in version 1.3. Additional functions have been added to the Registry and RegistryKey classes to aide with default values and getting registry keys by string name.

The console has been improved as well to make it easier to manage the screen buffer, once again this will all be available in the next release.

- Kelly

Tuesday, June 14, 2005

Today on PSC

Well, its' official. VBCorLib has won 2nd place for Code-Of-The-Month for the month of May on Planet Source Code. Oh joy!

Moving on... I found 2 bugs that will cause funny formatted numbers when using the NumberFormatInfo class. They have been fixed and will be included in the final version. Version 1.3 will be the final version, unless more bugs are found, though I can't forsee it (lol).

With the addition of the INIFile, INISectionWriter, and cTimer classes, I feel VBCorLib is ready for anything. The cTimer class has been improved to allow callbacks using AddressOf as well as events. This allows for the timer class to be used in modules without the WithEvents keyword. I always hated having to declare those variables only in a class.

So, I'm working on some examples now. Once I've covered a good portion of the library classes, I will release it all at once. Everything is looking good now...

- Kelly

Monday, June 13, 2005

Finale Plus One

Ok ok, I've broken down and added one last class that I think is handy. I've added a timer class (cTimer) to make things easier for re-occuring events.

But that's it!

- Kelly

The Finale Begins

Ok, so now I've included INI file support. I'm thinking that will be the end of VBCorLib. No more additions. Only fixes if they actually exist. Speaking of which, I found a huge problem with all of the Encodings. You can't encode an empty string and you can't decode a zero-length byte array. Both of those problems have been solved.

So now I'm working on a ton of examples to include with the library to show many of the aspects of the classes and how they work. Once I feel I have enough examples, then I'll release the entire group to the public. The only possible reasons to create new releases is for bux fixes, but I don't think there will be any more.

Ok, back to work
- Kelly

Saturday, June 11, 2005

It Has Begun

As much as I'd like to keep my hands of the library, it is difficult not to want to add more functionality. Has anyone noticed there is no INI file support? Amazing! And no one even brought it up. So now I've been learning all about them. I've never used them personally for anything, only heard everyone else using them.

I've also been improving the documentation. It will always be evolving as I find methods that aren't documented, or are so complex that an example is necessary. So you can always expect updates to both the library and documentation sometime in the future.

And that will be the end, I promise! ;)

Friday, June 10, 2005

New Stuff??

Well, with the latest release of VBCorLib out there, I can only hope everyone is enjoying it. I hope they are able to figure out how to use it. I've now put a compiled html help file in the Planet Source Code zip file and I've left it as a separate download at Source Forge.

I have found the library extremely useful. I wonder if other's have, too.

I don't know what I would do with it now. It's almost to the point where a new library sh0uld be built on top of this one. Maybe tackle the System.dll from .NET. That'll give some networking stuff going. It'll depend on if I have the time or need.

Version 1.2.2 Released!

Ok, I have release version 1.2.2. This version contains many features and classes from .NET 2.0. And as you have seen, cArray has been upgraded quite a bit. This version is the most complete release. I've even included a compiled HTML help file. I've begun using this in my production code.

You can download it at Source Forge.

cArray Upgrades Part 4

Hello again,

Yes, more improvements in the cArray class. First I found a gaping hole in the Copy method. When copying back into the same array and the destination falls within the source range of elements, it ends up copying the same element over and over. I thought the SafeArrayCopyData method was smarter, my bad. So now I've rewritten the entire copy section. It is optimized for value datatypes such as Longs. It correctly copies back into the same array. The UDT arrays have to match, and objects in the source array must be compatible with the destination array. This is checked on each object as it is attempted to be copied.

And of course, what would an upgrade be without the ability to shoot yourself in the foot? In the Copy methods there is the ability to pass in an address of a copy method that can be used to assign an element from the source array to the destination array. This allows for developers to perform custom assignments between the source and destination arrays.

Wednesday, June 08, 2005

cArray Upgrades Part 3

Well, I've now allowed developers to shoot themselves in the foot even more. The cArray.Sort* routines will now accept either an IComparer object, or an address of a compare function. This will allow direct access to the array elements as they are being sorted, making it easier to compare objects and userdefined types. They will be passed into the callback function as ByRef of the type specified. But since the developer need to ensure the signature of the callback method matches the datatype, there is plenty of room to blow things up. More power to you!

- Kelly

Tuesday, June 07, 2005

cArray 2.0 Upgrads Part 2

Ok, all of the Find* methods have been implemented. They even support UserDefined Types. It was an adventure learning about the IRecordInfo object and creating arrays for a UserDefined type without knowing about them before hand. The FindAll method returns an array of the same type as passed in, but only contains the elements that were matched successfully. This is where learning to create a dynamic UserDefinedType array had to be learned, as I would have no idea about your UserDefined types, yet I had to create a new array of them. The Find and FindLast methods return the first instance of a matched element in the array. If no elements matched, then the default value for that array datatype was returned. Well, if you passed in an array of UDTs, I had to return a default single UDT of your's. That is where my IRecordInfo adventure began.

Babble babble...

cArray 2.0 Upgrades

Well, I've been adding the Find methods found in the .NET 2.0 Array class to the cArray class. The upgrade is going nicely. These functions will allow developers to easily shoot themselves in the foot because it required the developer to supply a callback address using the AddressOf operator. In this sense, if the developer gives a bogus value, then BANG, it all comes down. But, by allowing the developer to use callbacks in the manner allows for the array elements to be directly accessed without making duplicates or having to cast datatypes. This is about as close to a delegate as we can get in VB6.

I've added yet more documentation. It seems to never end.. I really hate writing documentation, but who else is gonna do it? In the end I'm glad it's there.

good night

Monday, June 06, 2005

Console Features

It was a lot of fun implementing all of the new Console class features...

The .NET 2.0 version of Console contains an extensive set of functions to create elaborate console applications. I have incorporated them into VBCorLib's Console class. Now there is color, cursor and window positiong, window and screenbuffer sizing, and a host of other capabitlites. The Console class can now be used to create much better console applications using VB6.

Console Crashes on Exit

It has finally been brought to my attention that when using the Console and you exit a compiled application it crashes! I tracked down the problem and fixed it. I cannot actually see why the problem exists. I have given up on trying to understand why it breaks and just made it work a bit differently. The fix will be included in the next release of course, but what to do in the meantime? Well, thankfully VBCorLib is so flexible, you can fix it temporarily by inserting the following code before the first usage of the Console.

Dim sw As StreamWriter
Set sw = NewStreamWriter(Console.OpenStandardOutput, Encoding.ASCII)
sw.AutoFlush = True
Console.SetOut sw

This will make the Console use a different encoding when writing.

.NET 2.0 Implementations

Some of the existing classes have been upgraded to the .NET 2.0 version. The number of changes made makes it impractical to maintain Binary Compatiblity with version 1.0 of VBCorLib. Along with the upgrading of existing classes, new classes are being added from the .NET 2.0 specification.

First Post

Hello!

This is the first post. I figured since I am constantly changing VBCorLib, I should maintain a place where those changes can easily be expressed, and even receive feedback in a quicker fashion than having to wait until I release a build.