Archive for the ‘Porting Turbopower Essentials’ Category

Timers in .Net

Tuesday, June 17th, 2008

The scrolling marquee component in the Essentials suite made use of multimedia timers (timeSetEvent) to control the speed at which the text scrolled across the label. While a multimedia time has a finer resolution and is more accurate than a standard Windows timer, the multimedia timer caused problems in the form of sporadic uninitialized pointer errors. Since I was unable to track down the exact cause of the problem and since I didn’t need the additional accuracy provided by the multimedia timer, I switched to one of the standard timers provided by the .Net framework. Namely, System.Threading.Timer.

(more…)

TRect, TPoint and TSize Moved

Monday, June 16th, 2008

The TRect, TPoint and TSize classes and their supporting functions like Rect and Point have been moved to the Types unit!

AllocateHWnd and DeallocateHWnd Moved

Monday, June 16th, 2008

The AllocateHWnd and DeallocateHWnd functions have been moved to the WinUtils unit!

Variant Records Unsafe in .Net

Monday, June 16th, 2008

It turns out that variant records, that is records with overlapping fields, are considered unsafe by the .Net CLR. A pity, since I use these things all the time to crack message buffers and the like. Fortunately, what .Net takes away, new features of the Delphi language give back. Because it is now possible to have methods and properties attached to records it is fairly easy to simulate variant records.

(more…)

Namespaces in Delphi.Net

Monday, June 16th, 2008

I initially found the use of namespaces in Delphi.Net to somewhat confusing. I think the reason for this was the project Default Namepsace property. Although using the default namespace provides a nice short hand way of assigning all units in your project to the same namespace, it makes the naming of the units and source files a bit confusing, at least to me.

(more…)

Using String Resources in Delphi.Net

Friday, June 13th, 2008

The first thing that became apparent was that a lot of unsafe code was being used to access string resources. Turbopower also used a proprietary string resource compiler to create the .RES files from text files.

A little research revealed much better ways of doing this in .Net. By using the ResGen tool and the ResourceManager component supplied with the .Net 2.0 SDK it was possible to eliminate the unsafe code and drastically reduce the size and complexity of the string resource handling code as well.

(more…)