Archive for July, 2009
Posted by jpluimers on 2009/07/29
I’m using FastMM in our projects when debugging memory allocations.
It is a great tool, but documentation is sparse.
Hence this post: point to some introductory articles and add some of my own experiences.
Later on, I will show some more advanced use.
These posts are already available in this series:
- Delphi – FastMM: Using FastMM4 for debugging your memory allocations – part 1: Introduction
- Delphi – Using FastMM4 part 2: TDataModule descendants exposing interfaces, or the introduction of a TInterfacedDataModule
So now lets get on with the introduction:
Read the rest of this entry »
Posted in Delphi, Development, FastMM | 23 Comments »
Posted by jpluimers on 2009/07/27
When you add a non-Delphi file to your project, the current (Galileo based) IDE’s add them only to your .dproj file.
But older Delphi’s used to add them to the .dpr file using the (undocumented) {%File pseudo-directive.
When including the file ..\src\Defines.inc, you need this pseudo-directive: {%File ‘..\src\Defines.inc’}
The .dpr import wizard knows about it: if you have a lonely .dpr file using the {%File pseudo-directive, it will be correctly reflected in the .dproj file.
Read the rest of this entry »
Posted in Delphi, Development, FastMM | Leave a Comment »
Posted by jpluimers on 2009/07/23
Sometimes, indexed properties can make your life much easier: they allow you to redirect single properties to central Get/Set methods.
You don’t see it used very often, but when you need it, it is very handy.
There is even some online help on it (look for “Index Specifiers”) it gives you the basics, but no compiling example.
For me it works best when I have a complete, but concise example.
So here is one: TMyIndexedPropertyComponent that has property Range1Value through Range4Value of type TRange, all centralized to one pair of read/write methods: GetRangeValue and SetRangeValue.
Read the rest of this entry »
Posted in Component Development, Delphi, Development, Package Development, Software Development | 2 Comments »
Posted by jpluimers on 2009/07/22
Did you ever get this error message when creating TFrame descendants?

---------------------------
Error Reading Form
---------------------------
Error reading TDioptreFrame.ClientHeight: Property ClientHeight does not exist. Ignore the error and continue?
NOTE: Ignoring the error may cause components to be deleted or property values to be lost.
---------------------------
Ignore Cancel Ignore All
---------------------------
It is odd: TFrame descendants do not have a ClientHeight property!
If you press Cancel, then you get this error message.

---------------------------
Error
---------------------------
Error creating form: Error reading TDioptreFrame.ClientHeight: Property ClientHeight does not exist.
---------------------------
OK
---------------------------
I did, and here is a reason why it can happen.
Read the rest of this entry »
Posted in Component Development, Delphi, Development, Package Development, QC, Software Development | 15 Comments »
Posted by jpluimers on 2009/07/16
I have been using Delphi Frames as visual components for quite some time now.
They make it really easy to use the Delphi IDE to visually design your component.
This makes the development process for creating visual components much easier and faster.
There are some things you need to watch when doing this, so I’ll devote a few blogs posts on this topic over the next couple of months.
A few of the things are:
- When you put components on your frame, and later drop that frame as a component on a Delphi form or frame, the components are visible in the Structure Pane.
- The
Visible property is ignored at design time.
- You need to watch resizing.
- Frames do not have
OnCreate and OnDestroy events.
- Error messages about a missing
ClientHeight property.
- You can still drop other components on your frame.
- … probably some more that I forgot right now…
The first blog on this series is about the first issue:
When you put components on your frame, and later drop that frame as a component on a Delphi form or frame, the components are visible in the Structure Pane.
The bad thing about this is that you can now delete the components on the frame using the structure pane.
This leads to all sorts of problems (mostly access violations).
Read the rest of this entry »
Posted in Component Development, Delphi, Development, Package Development, Software Development | 5 Comments »
Posted by jpluimers on 2009/07/16
I just found out that in my updates to TFS 2008 Folder Comparison Filter for both C# and Delphi projects somehow some backslashes (\) were missing.
Oops, sorry :-)
These backslashes are important when excluding directories: if omitted, TFS thinks you want to exclude a filename in stead of a directory name (see Folder Comparison Filters).
It might be due to the HTML pasting issue that I explained in Including formatted sourcecode in WordPress.
Anyway, here is the correct one that has the backslashes at the right places:
!*.pdb;!*.obj;!*.dll;!*.exe;!*.res;!*.resources;!*.cache;!*.ilk;!*.ncb;!obj\;!objd\;!bin\;!lib\;!*.local;!*.identcache;!*.dcu;!__history\;!*.dsk;!*.~*;!*.stat;!*.drc;!*.map;!*.csproj.user;!*.vbproj.user;!*.csproj.webinfo;!*.vbproj.webinfo;!*.suo;!*.bpl;!*.dcp;!*.log;!*.lck
(Note these all should be on one line when pasting them).
–jeroen
Posted in .NET, C# 2.0, C# 3.0, Delphi, Development, Prism, Software Development, Source Code Management, TFS (Team Foundation System), WordPress | Leave a Comment »
Posted by jpluimers on 2009/07/15
Somehow, at every client I need a function like GetExecutablePath.
Maybe you do too, so here is the code that I adapted a long time ago from the Delphi 2006 RTL:
using System;
using System.Diagnostics;
using System.Reflection;
namespace bo.Reflection
{
public class AssemblyHelper
{
public static string GetExecutablePath()
{
// borrowed from D2006\source\dotNet\rtl\Borland.Delphi.System.pas function ParamStr():
string result;
Assembly entryAssembly = Assembly.GetEntryAssembly();
if (null != entryAssembly)
{
result = entryAssembly.Location;
}
else
{
Process currentProcess = Process.GetCurrentProcess();
ProcessModule mainModule = currentProcess.MainModule;
result = mainModule.FileName;
}
return result;
}
}
}
Enjoy :-)
–jeroen
Posted in .NET, C#, C# 2.0, C# 3.0, Delphi, Development, Software Development, Visual Studio and tools | 2 Comments »
Posted by jpluimers on 2009/07/15
Don’t know how many decades ago I got the idea, and there are probably dozens of unfinished samples like these, but below is complete one.
bo.Forms.TextBoxTraceListener.
But first the feature list:
- Allows Trace statements to be catched in a TextBox (you probably guessed this from the name TextBoxTraceListener)
- Works in both the UI and non-UI threads (so it does not fail when calling from a non UI-thread)
- Supports Write and WriteLine (no need to override the others as they all come down to this)
- Does not do indentation (hey, it’s quick and dirty!)
Note that TextBox.Text is not meant for large amount of data, or frequently appending to the data, but again: it’s meant as quick and dirty, not as your tracing ‘silver bullet’.
Read the rest of this entry »
Posted in Debugging, Development | Leave a Comment »
Posted by jpluimers on 2009/07/10
At a client, I had to backup their Windows XP Embedded Database using DBRESTORE.VBS.
You can find more about that tool in DBRestore Command Line Syntax.

Error 80070006 during dbrestore.vbs execution
This tool is supposed to be run from the command-line, but the first thing I got was an error 80070006.
Since I the client was running a Dutch Windows system, the error would manifest itself as this:
---------------------------
Windows Script Host
---------------------------
Script: C:\temp\ValueAdd\dbrestore.vbs
Regel: 72
Teken: 2
Fout: De ingang is ongeldig.
Code: 80070006
Bron: (null)
---------------------------
OK
---------------------------
Although I’m not a VBS programmer, I know how to read source code in various languages, so below is how I solved the issue.
Read the rest of this entry »
Posted in VBS, XP-embedded | Leave a Comment »
Posted by jpluimers on 2009/07/09
Here is another update for the TFS 2008 Folder Comparison Filter for both C# and Delphi projects:
Exclude .bpl, .dcp, log and .lck files.
So then the search filter becomes this:
!*.pdb;!*.obj;!*.dll;!*.exe;!*.res;!*.resources;!*.cache;!*.ilk;!*.ncb;!obj;!objd;!bin;!lib;!*.local;!*.identcache;!*.dcu;!__history;!*.dsk;!*.~*;!*.stat;!*.drc;!*.map;!*.csproj.user;!*.vbproj.user;!*.csproj.webinfo;!*.vbproj.webinfo;!*.suo;!*.bpl;!*.dcp;!*.log;!*.lck
(Note: this all goes on one line; your web-browser probably wraps this over multiple lines, so you might need to undo that wrapping before pasting it in to TFS).
Have fun with it!
–jeroen
Posted in .NET, Delphi, Development, Software Development, Source Code Management, TFS (Team Foundation System), Visual Studio and tools | Leave a Comment »