Archive for the ‘Delphi XE5’ Category
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/31
A while ago, I noticed the UCL as a suffix in a few 3rd party Delphi package names.
It was from a version close to the very first FireMonkey release. FireMonkey is based on the OpenGL based VGScene (and in part DirectX based [WayBack] DXScene) which was bought form KSDev in 2011.
Contrary to VGScene and DXScene, the early versions of FireMonkey were buggy and when updating to a new version you had to cope with a lot of breaking interface changes. In Delphi XE2 for instance, there were two totally different implementations (FMX for Windows and OS X; FMI for iOS) that merged after Delphi XE3.
Around Delphi XE6 it became more stable and now – apart from some design issues I wish they had done differently – it is coming along sort of OK for Windows and for cross-platform development.
Compared to the VCL you have a lot less HiDPI issues but the designer is much more layered (which gives you the same design-time pain as WPF) and the default “Live Binding” is still buggy as hell (though if you use something like MVVM or roll your own UI bindings it becomes bearable).
A long time ago – during the Kylix era – Borland developed the cross-platform CLX library which – for the UI part – was based on Qt and ran on both Windows and Linux.
It looks like before the KSDev take over there seemed to be a UCL (would that have been for Universal Component Library or Universal Control Library?) as the name pops up in quite a few package names.
Browsing through the source code I could not find any hints so I really wonder what UCL was about. Was it again based on Qt (which compared to the Kylix era has become much more mature and has widespread use) or a different technology like LCL (given that in Delphi XE2 they used FreePascal to compile for iOS)? I rule out OpenGL as otherwise the VGScene acquisition would have been done a lot earlier.
–jeroen
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 6, Delphi 7, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, FireMonkey, Kylix, OS X FMX, Software Development | Leave a Comment »
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/28
I’ve quotes two of the G+ comments as they perfectly reflect my point of view: the non-modal search and IDE Insight – introduced somewhere after XE3 – are a dork to use.
I’m doing more Delphi work lately and these being non-modal seriously hinder my work (and it gets progressively worse on a 3K or 4K monitor).
In my book: why implement a feature to emulate the competition when you do it so badly?
So: are there any experts around that bring back the old search and IDE Insight behaviour back?
Asbjørn Heid, Oct 5, 2015:
+Marco Cantù I’m pretty sure I’ve mentioned it before, but hey:
- The new edit field cannot be placed in a position which does not require significant eye-focus change to read. This means it is significantly more cumbersome to use, as focus must be transferred to some “out of sight” area. In addition one does not get the same instant feedback that the IDE did register your F6 keypress. The old one was “in your face” instantly when you pressed F6, so no need to take your eyes off the form you’re designing, and it left no doubt about F6 being registered or not.
- The dropdown list with suggestions that pops up when you type is much more difficult to read than the list in the old one, both due to positioning (thanks to the above) and due to length until it’s heavily constrained by input.
- From what I recall, the new edit field does not behave the same when invoked repeatedly, requiring more keystrokes to get the same effect compared to the old. I haven’t used XE3 in ages though so I don’t recall the specifics anymore, just that the new feels more clunky to use.
That’s just off the top of my head. Yes I still use it, but not nearly as much as I did, and when I do it’s one to two orders of magnitude slower to use compared to the old one. Not because it searches slower, but because of the issues described above.
Similarly for the non-modal search, although somehow I’m more used to the modern version now. When compared with VS though the Delphi search is very lacking. The great thing about the VS search is that it gives live feedback on which text in the edit window match the text in the search window. If Delphi would do that it would make an immense difference. It’s definitely worth spending some time in VS using their search facility. And indeed in other IDEs / editors.
There was a lot of negative feedback on both of these changes when they were released. Surely Embarcadero noticed that.
–jeroen
via: F6 or [Ctrl] + . does not open IDE Insight on DX. What am I missing?…
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Power User, Software Development | 2 Comments »
Posted by jpluimers on 2016/07/28
In hindsight, what they should have done when ZEROBASEDSTRINGS were introduced (yes, Delphi XE4):
Matlab and zerobasedstrings
–jeroen
via: At the MathWorks headquarters Source: http://redd.it/3bl5m1 #matlab….
Posted in Delphi, Delphi 10 Seattle, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 1 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 »
Posted by jpluimers on 2016/04/21
The below fragment is one of the favourite kinds of examples in the Ruby world:
5.times { |i| print i, " " }
It uses the times method on Integer and prints:
0 1 2 3 4
There are many implementations of this in other languages, for instance Ruby’s ‘times()’ function in C# | Of Code and Me (which the WordPress.com editor fucked up as it replaced Action<int> with Action which is a totally different thing, so the gist with code is below.
public static class IntExtensions
{
public static void Times(this int i, Action func)
{
for(int j = 0; j < i; j++)
{
func(j);
}
}
}
Which you use as
5.Times(i => Console.Write(i));
It’s slightly off as it prints:
01234
I know; nitpicking, but this code works (did I ever tell I love .NET fiddle?):
5.Times(i => Console.Write("{0} ", i));
Well, Mason Wheeler encouraged Asbjørn Heid for the below Ruby Mania in Delphi; just read the comments at In C# nearly everything is an object, so when writing a unit test for a string…
Since the WordPress.com editor fucks up TProc<Integer> into TProc and TProc behaves differently from TProc<Integer>, I’ve included a gist link with the actual code below.
program RubyManiaConsoleProject;
uses
System.SysUtils;
type
TRubyMania = record helper for ShortInt
procedure times(const IterBody: TProc);
end;
procedure TRubyMania.times(const IterBody: TProc);
var
i: Integer;
begin
for i := 0 to Self-1 do
IterBody(i);
end;
begin
5.times(
procedure(i: Integer)
begin
Write(i, ' ');
end
);
end.
It also shows why I hardly use anonymous methods in Delphi: they’re way too verbose.
–jeroen
Read the rest of this entry »
Posted in Conference Topics, Conferences, Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Event, Software Development | 1 Comment »
Posted by jpluimers on 2016/04/05
The “Official statement” of Embarcadero about their recent hacks are in the form of comments on public messages mentioning the hacks, some asking to take discussions offline.
They forgot to comment on Delphi: disable or change your welcome page to not use the Embarcadero site (as that site has been hacked twice this weekend) « The Wiert Corner – irregular stream of stuff, so here is their comment from the G+ thread I posted:
FYI: Future versions will no longer have the banner pulled from the website on the start page.
Source: This weekend, the Embarcadero web site was hacked by AnonCoders. once…
I hope it will be the upcoming Delphi 10.1 Berlin version, but given their speed at responding to security threats, I won’t hold my breath.
–jeroen
PS: what a coincidence that I wrote this yesterday on G+:
I know of a few companies that could benefit from more openness.
Ilya Grigorik originally shared: Edge team announced new (EdgeHTML) open issue tracker: http://bit.ly/1S3uhp5 – yay! The times, they are changing.File away!
Posted in Delphi, Delphi 10 Seattle, 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 | Leave a Comment »
Posted by jpluimers on 2016/03/17
Stefan Glienke worded it perfectly: Default(typeIdentifier) is a “magic” function that is implemented into the compiler and causes it to generate the correct code – like for records with managed fields it generates a call to FinalizeRecord and some instructions to zero the remaining fields.
Source: I know I can write MyRecordVar := Default(TMyRecordType) because I asked a qu…
–jeroen
Posted in Delphi, Delphi 10 Seattle, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »