Sunday, December 16, 2007

VB 6, damn VB 6

This week i have been finshing off the COM Library for VB6 and also making the VB6 showcase. Just like last week this was full of problems. The default of Option Explicit being turned off got really annoying... one time i was trying to load a font and typed arial.ttf and i forgot to put the "" around it, with Option Explicit off VB6 tried to get the property of the variable arial... and it was giving me a strange error. It ended up taking me all most a whole day to work out what the cause of this error was. Then after this error... there was more.

I discovered that trying to pass an array from VB6 to C# COM library is very anoying... For some strange reason VB6 hates this. After a bit of searching on the net i came up with nothing... then Andrew said to search for "marshaling arrays with COM and VB" and the very first link was someone who had the exact problem as me and they had found an answer!! All i need was "[In] ref" in the front of the array in C#.

Work on the showcase was going fine until i came to the vector collision example. This would work for a short time then just crash with a error msg that gave no help. I couldnt track down the source of this error as all the VB6 code looked fine and so did the COM Library. Stephen discovered that for some reason the C# library was returning doubles instead of singles for most of the physics methods. This was causing errors for me in VB6 land. Once all the doubles were changed to singles it all worked fine.

My latest problem is our AddingVectors method... for some reason its not working at all :(. I hope to get this working soon so i can finally finish off this showcase.

After the showcase is finished ill start working of the VB6 documentation for VB6 on our Wiki on www.swingame.com

No comments: