Archive for the ‘Delphi 2006’ Category
Posted by jpluimers on 2016/12/14
Back in the .NET days, Delphi had an FINITEFLOAT compile option that came without a single-character shortcut.
It was about the handling of infinite float and other special float values in cases like overflow and underflow (including +Inf, -Inf and [Wayback] NaN).
At first – in the [Wayback] Delphi 8 (Octane) era of which few people want to be reminded off – it was the [Wayback] undocumented counterpart of the [Wayback] 8087 exception mask in x86 mode. Hallvard Vassbotn wrote an article about it and Chee Wee Chua documented it before it got documented in Delphi 2009 (that coincidentally dropped .NET support in the compiler – go figure):
Whereas the native Delphi compilers had exceptions turned on, Microsoft compilers (including .NET) had them turned off, hence the compiler option.
Like most new Delphi features in this century, FINITEFLOAT didn’t come without quirks. Often these are fleshed out in 2-3 product releases, but this one wasn’t:
The FINITEFLOAT compile option didn’t have a single-character shortcut. This made it impossible to use the {$IFOPT ...} construct as IFOPT only works for single-character compiler options.
Which means you get questions like [Wayback] Why doesn’t {$ifopt FINITEFLOAT ON} compile? – Stack Overflow (I actually got into writing this article because I found a {$DEFINE FINFINITEFLOAT_ENABLED} in some pretty old code) and compiler enhancement requests like [WayBack] QualityCentral – Please enhance the IFOPT directive for long switch names. It’s easier to read (which will likely never bee fixed).
For completeness some more information about exception masks in the native compiler:
- In the past you could only set the exception mask as part of the full control word using [Wayback] Set8087CW, nowadays you can use [Wayback] SetExceptionMask.
- Next to a precision mask, there are five exception masks you can set, see for instance this table from the [Wayback] Simply FPU Chap.1 Control Word section:
PM (bit 5) or Precision Mask
UM (bit 4) or Underflow Mask
OM (bit 3) or Overflow Mask
ZM (bit 2) or Zero divide Mask
DM (bit 1) or Denormalized operand Mask
IM (bit 0) or Invalid operation Mask
–jeroen
Posted in 8087, Algorithms, Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 8, Development, Floating point handling, History, QC, Software Development | 1 Comment »
Posted by jpluimers on 2016/12/01
Posted in Delphi, Delphi 10 Seattle, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development, Uncategorized | Leave a Comment »
Posted by jpluimers on 2016/11/29
A long time ago, Lars Fosdal wrote this on the Delphi G+ group:
It really is beyond me why there is no Project.rc file which includes
- Project.version.rc
- Project.icon.rc
- Project.themes.rc
- Project.manifest.xml
- and so forth.
That way, the .res file would be a compile-time thing (or even a thing of the past) – and the resource linker would assemble the various bits from their individual sources.
It has been an issue forever. Vincent Parrett correctly commented that if you clean out too much out of the Project.res file, the IDE gets confused:
The only thing it is used for is version info and the mainicon (the IDE gets confused if don’t do that).
In my own experience, this isn’t the case for all Delphi versions, but I forgot which versions suffer and which don’t. I think the IDE theming issue omitting the Application word in the .dpr is related.
Like many of the G+ commenters, I’ve switched to script based resources for my own projects a long time ago. That’s also the reason why I forgot: this approach just works for any Delphi version.
This post is a reminder to self to see if the IDE has finally refrained from doing Project.res handling itself.
–jeroen
Source: The curse of the Project.res file…
Some related posts:
Posted in Delphi, Delphi 1, Delphi 10 Seattle, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 5 Comments »
Posted by jpluimers on 2016/10/20
I will probably need this in the future as occasionally I still do Delphi work:
–jeroen
Posted in Delphi, Delphi 2006, Delphi 7, Development, Software Development | 2 Comments »
Posted by jpluimers on 2016/09/06
I’ve published the Delphi version info table as a Gist: https://gist.github.com/jpluimers/b5891600b73642788b492393710c6070.
Note I need help with these:
The updated script that forms the base of this table is here: https://bitbucket.org/jeroenp/wiert.me/src/tip/Native/Delphi/Scripts/List-Delphi-Installed-Packages.ps1
You can pass any of these args to get information
- Individual columns:
- CompanyNames, Versions, ProductNames, ProductVersions, BetaNames. ReleaseDates, Architectures, CharacterSets, Defines, CompilerVersions, RTLVersions, DllSuffixes, ProjectVersions, Frameworks, ProductVersions, ProductFullNames, BaseKeyPaths, HKCU-BaseKeyPaths, HKLM-BaseKeyPaths
- Base of the below table:
- Installed info (installation status obtained through the registry):
- InstalledProductVersions, InstalledProductFullNames, InstalledProductSummaries, InstalledPackages
An elaborate wrapper around the Define column is jedi.inc which is used in many projects (both open source and closed source) to distinguish between various Delphi versions, libraries and platforms at compile time (URL: github.com/project-jedi/jedi/blob/master/jedi.inc)
Read the rest of this entry »
Posted in .NET, C#, C# Builder, Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 5 Comments »
Posted by jpluimers on 2016/09/01
Thanks Primož Gabrijelčič for reminding me on Stack Overflow that Alt + Down opens the dialogs behind ellipsis buttons in the Delphi IDE.
It’s the CUA and Windows short-cut to open drop-down lists (comboboxes) and for opening drop-down list for a property in the object inspector, but I never realised also would work for these ellipsis buttons.
This was my original stack-overflow question: Is there a keyboard shortcut for the ellipsis buttons of the Project Options in the Delphi IDE?
The Project Options in the Delphi IDE has a few option (like the Search Path) each with an ellipsis button (the one on the right having only three dots ... in the image below) to pop-up a dialog.
What keyboard shortcut activates that button?

–jeroen
Via: Object Inspector Keyboard Shortcuts – RAD Studio
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Keyboards and Keyboard Shortcuts, Software Development | Leave a Comment »
Posted by jpluimers on 2016/08/31
Recently when printing the 3rd time and up, you get this error in many Delphi programs and the Delphi IDE:

Printer is not currently printing.
In the past this only occurred when you used a TPrinter and forgot to call BeginDoc.
But now it always occurs after reusing the same TPrinter instance for the 3rd time and up. Since the Delphi Galileo based IDEs (8 and higher; likely older ones as well: the source code printing hasn’t changed in a long time). The error actually occurs twice: after starting a source code print job, but also after cancelling the same failed source code print job.
The second error stroke me as odd, so I went searching for “printer is not currently printing” “IDE” leading to this stack overflow question: c++builder – Why is TPrinter (XE7) suddenly having problems today? – Stack Overflow [WayBack].
The pattern there is using the Printer() function which has been the way the (un)official code examples have shown for ages (Delphi 2007 Printers.Printer Function [WayBack]; earlier examples like Delphi 7 [WayBack] usually in PDF files).
Like in the Delphi 7 “5-32 Developer’s Guide” page example:
procedure TForm1.Button1Click(Sender: TObject);
var
r: TRect;
i: Integer;
begin
with Printer do
begin
r := Rect(200,200,(Pagewidth - 200),(PageHeight - 200));
BeginDoc;
Canvas.Brush.Style := bsClear;
for i := 0 to Memo1.Lines.Count do
Canvas.TextOut(200,200 + (i * Canvas.TextHeight(Memo1.Lines.Strings[i])),
Memo1.Lines.Strings[i]);
Canvas.Brush.Color := clBlack;
Canvas.FrameRect(r);
EndDoc;
end;
end;
(Yes, that’s back in the D7 days when examples were still using with and not using try/finally statements for resource cleanup).
Actual cause and permanent fix
The printing problems are caused by various recent Windows updates part of MS16-098:
Though MS16-098: Security update for Windows kernel-mode drivers: August 9, 2016 mentions the issue without a fix, KB3177725 in MS16-098: Description of the security update for Windows kernel-mode drivers: August 9, 2016 mentions both the issue and a permanent fix:
After you apply this security update and you print multiple documents in succession, the first two documents may print successfully. However, the third and subsequent documents may not print.
To resolve this issue, install update 3187022. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
3187022 Print functionality is broken after any of the MS16-098 security updates are installed
This article describes printing issues that occur after any of the security updates that are described in Microsoft Security Bulletin MS16-098 are installed in Windows. You can fix these issues by installing the update that is described in this article. Before you install this update, check out the Prerequisites section.
This update applies to the following operating systems:
- Windows Server 2012 R2
- Windows 8.1
- Windows RT 8.1
- Windows Server 2012
- Windows Server 2008 R2 Service Pack 1 (SP1)
- Windows 7 SP1
- Windows Server 2008 Service Pack 2 (SP2)
- Windows Vista SP2
No solution for Windows 10 yet…
Until you install the fix: workarounds
For your own code (Thanks Remy Lebau for your answer), add this code for your BeginDoc call:
MyPrinter.Copies := MyPrinter.Copies;
You might want to keep including this in your code as you’re never sure when the end-users apply which Windows update.
For the Delphi IDE either:
- Press the “Setup…” button in the “Print Selection” dialog when printing source code, then “OK” in the “Print Setup” dialog:

Print Selection dialog

“Print Setup” dialog.
- Uninstall the security updated marked in blue (Security Update for Microsoft Windows (KB3177725):

Security Update for Microsoft Windows (KB3177725)
–jeroen
Read the rest of this entry »
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 8, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 2 Comments »
Posted by jpluimers on 2016/08/25
Delphi Component/Tool vendors have to support a truckload of Delphi and C++ Builder versions which can be a pain: they have to work around problems in Delphi and C++ Builder versions that have long been abandoned by Borland/CodeGear/Embarcadero/Idera/…
This means that sometimes the Delphi Component/Tool vendors have to work around stuff in a way normal applications vendors would never do.
Recently I learned that sometimes this can be a painful thing: keeping DFM files in binary state.
I’m not kidding about either the DFM file format nor about supporting old versions:
- Delphi has supported text based DFM files since like Delphi 2 for most of the features (yes, ‘most’ is the crucial word here) and by default stored DFM files in text format since Delphi 5.
- For the Component/Tool Vendors, even Delphi 7 makes money though usually less than Delphi 2007 or the C++ Builder side of things.
The ‘most’ applies to this nice ARM compiler bug in Delphi 19.0.13856.4978 (for mere mortals, that’s Update 1 for RAD Studio XE5, Delphi XE5 and C++Builder XE5; I wish vendors would list those numbers/products in a central place):
- [Android] MsBuild (dccAarm) error when compile FireMonkeyMobile projects with fmx forms
- Project: Delphi
- Build #: 19.0.13856.4978
Source: [WayBack] QualityCentral
That’s why TeeChart still has most DFM files stored as binary files (again the ‘most’ word).
For version control and searching this is a pain, so normal application developers (the ones not using Delphi XE5 Update 1 for Android work) should run convert.exe with the -t (target=text) switch on DFM binary files.
Oh: this is fixed in version 19.0.13856.4978 (yes, that’s XE5 Update 2).
–jeroen
Via:
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Kylix, QC, Software Development | Leave a Comment »
Posted by jpluimers on 2016/07/26
A while ago, StackOverflow user Kobus Smit did some brilliant editorial work that – due to current state of StackOverflow – sort of fired backwards: his question got marked as duplicate before he could post his excellent answer. After that answer was posted, the oh-so pride SO-demi gods never took any energy to revisit to see which answers were best.
His simple question:
How can my Delphi app easily write to the Windows Event Log?What is the difference between TEventLogger and ReportEvent? How do I use the ReportEvent function?
Which somehow should be encompassed by this Delphi 5 question (apparently that 15+ year old Delphi version is still considered current by the SO demi-gods).
The answer summarises and extends existing answers spread out over StackOverflow and adds an EventLog git repository wrapping the ReportEvent and RegisterEventSource (which somehow is always a pain: Delphi services for instance often forget that).
Lesson learned when doing editorial work:
- prepare both the answer and question in markdown off-line
- ensure you mention in the question that the answer is meant as collection of “best of” answers found elsewhere
- post the question and answer in rapid succession
- cross your fingers for the StackOverflow demi-gods being in a good mood
–jeroen
via: Writing to the Windows Event Log using Delphi – Stack Overflow
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 1 Comment »
Posted by jpluimers on 2016/07/12
Recently I bumped into a thing that I’d long forgotten: the Delphi compiler treats searching for include files (any files used with the {$I} or {$include} directive differently:
- The compiler first searches the directory where the file that is including resides and then uses the project and IDE search paths.
- The IDE only uses the project and IDE search paths.
This means that when you press Ctrl-Enter on the filename to be included you might edit a different file than the compiler will include.
So when a product has multiple include files with the same name in different sub-directories, then you must modify them all.
I’m not sure this is a bug or feature, so Embarcadero is free to put this in either their QA system or documentation system.
–jeroen
Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 2 Comments »