Archive for the ‘Delphi 2007’ Category
Posted by jpluimers on 2018/01/10
As a by-effect, this article seems to one of the few that shows where Delphi uses the .dres file extension introduced around Delphi XE.
Recently I had to play some notification sounds in a Windows Delphi application where the application deployment should be as easy as possible: preferable copying the EXE around.
Playing a sound file seems easy, especially if it is a [WayBack] WAV file: just use the [WayBack] PlaySound or the (older) [WayBack] sndPlaySound API functions.
But if you start searching on the internet, you see lots of curious implementations for playing WAV resources through sndPlaySound.
The actual implementation is really really easy though, just make sure you follow the steps right and nothing can go wrong.
[WayBack] The full source code is on my BeSharp.net repository, here is how to to it step by step:
The steps depend on the MMSystem unit, so most of the code translates back to [WayBack] Turbo Pascal for Windows (yes, the 16-bit Pascal days when the MMSystem unit was introduced) with the exception of the SND_SENTRY flag.
The thing that more recent Delphi versions made a lot easier is embedding WAV files as WAVE resources, more on that further on. Read the rest of this entry »
Posted in Borland Pascal, Delphi, 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, Development, Pascal, Software Development, Turbo Pascal | Leave a Comment »
Posted by jpluimers on 2017/11/30
Note that the below solution works for any project raising the W1029 warning (not just from projects using Delphi Mocks) like
[dcc32 Warning] W1029 Duplicate constructor 'ClassName.ConstructorName' with identical parameters will be inacessible from C++
From my original text at [WayBack] Get rid of W1029 warning in Delphi compile mode · Issue #106 · VSoftTechnologies/Delphi-Mocks · GitHub:
By default the compiler will emit warnings like these for projects when using either of the Delphi.Mocks.Behavior or Delphi.Mocks.Expectation directly or indirectly:
[dcc32 Warning] W1029 Duplicate constructor 'TExpectation.CreateOnceWhen' with identical parameters will be inacessible from C++
They’re harmless as DUnitX doesn’t support C++. This particular warning type cannot be disabled on the unit or source line level which means you have to disable it on the project level by either:
- adding
{$WARN DUPLICATE_CTOR_DTOR OFF} anywhere to your .dpr project file
- modifying the the Project Options for your project (easiest is in the
All configurations - All platforms target):
- follow the path
Delphi Compiler, Hints and Warnings in the treeview on the left
- expand the
Output warnings node in the listview on the right
- set
Duplicate constructor/destructor with identical parameters will be inacessible from C++ to Error
A screenshot of the second option is below.
Note that the spelling mistake in Duplicate constructor/destructor with identical parameters will be inacessible from C++ is how it is in the IDE, but that as Google search string it will give limited results, so here are some back-ground references:

Read the rest of this entry »
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), 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 2017/09/25
At the end of April 2014, Roman Yankovsky started a nice [Wayback] discussion on Google+ trying to get upvotes for [Wayback] QualityCentral Report #: 124402: Compiler bug when comparing chars.
His report basically comes down to that when using Ansi character literals like #255, the compiler treats them as single-byte encoded characters in the current code page of your Windows context, translates them to Unicode, then processes them.
The QC report has been dismissed as “Test Case Error” (within 15 minutes of stating “need more info”) by one of the compiler engineers, directing to the [Wayback] UsingCharacterLiterals section of Delphi in a Unicode World Part III: Unicodifying Your Code where – heaven forbid – they suggest to replace #128 with the Euro-Sign literal.
I disagree, as the issue happens without any hint or warning whatsoever, and causes code that compiles fine in Delphi <= 2007 to fail in subtle ways on Delphi >= 2009.
The compiler should issue a hint or warning when you potentially can screw up. It doesn’t. Not here.
Quite a few knowledgeable Delphi people got involved in the discussion:
Read the rest of this entry »
Posted in Ansi, ASCII, Conference Topics, Conferences, CP437/OEM 437/PC-8, Delphi, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Development, Encoding, Event, ISO-8859, Missed Schedule, QC, SocialMedia, Software Development, Unicode, UTF-8, Windows-1252, WordPress | Leave a Comment »
Posted by jpluimers on 2017/07/04
Just in case I need any of them: now in chronological order.
MarcoDelphiBooks – http://www.marcocantu.com
Source: MarcoDelphiBooks
–jeroen
Posted in Delphi, Delphi 2005, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2017/05/17
Brilliant:
if it is a console program and it was started any other way (from the Windows Explorer, from the Delphi IDE with or without debugger, from another non-console program), then, before the console window can close, it will display:
Press any key...
Source: Delphi Corner Weblog: New: Velthuis.AutoConsole unit [WayBack]
via:
–jeroen
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, FastMM, Software Development | Leave a Comment »
Posted by jpluimers on 2017/02/07
A long time ago, Thomas Mueller (dummzeuch) – Google+ reminded [WayBack] me of this which I required a short while ago:
You can use AcquireExceptionObject():
AcquireExceptionObject returns a pointer to the current exception object and prevents the exception object from being deallocated when the current exception handler exits.
Then you can send the pointer to another thread and if you raise it there it will be freed for you, otherwise you must call ReleaseExceptionObject() to free it.
After the answer by Remy Lebeau [WayBack] and Remko [WayBack] is a comment [WayBack] by [WayBack] that mentions AsyncCalls.pas that now is available on GitHub [WayBack].
If you have a very old (version <= 5) Delphi or just want to look at how AcquireExceptionObject [WayBack] looks like just look at a similar implementation there [WayBack]. Note that instead of the ReleaseExceptionObject [WayBack] call, AsyncCalls re-raises the exception [WayBack].
–jeroen
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, 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 2017/02/01
Every now and then you want to know what units your project is made of. Not just the units require to build your project, but actually the ones ending up in the executable (i.e. not removed by the compiler or linker).
I had long forgotten that Chris Hesik [WayBack] wrote in debugging – How can I find all the units in my Delphi app? – Stack Overflow [WayBack]:
you can have the Delphi compiler show you a list of used .dcus by passing –depends when you compile a project. It will output a .d file with a list of the .dcus (and .dcps) that were required.
This reminded me of that: The –depends option is supposed to work with the Delphi compiler, and it outputs a .d file. Does it still work in Berlin, and where is the file supposed to be output to? – David Nottage – Google+ [WayBack]
In the mean time, I wrote a batch file that parses the .MAP file to see which units actually made it into your .EXE [WayBack] which works only for Widows executables (as I hardly do cross-platform Delphi development).
Uwe Schuster [WayBack] reported the IDE won’t pass on the –depends switch in Delphi XE and up (version 15.0.3953.35171) [WayBack] which means you need to pass this from the command-line.
Ondrej Kelle (G+/SO) pointed out that:
msbuild hello.dproj /property:DCC_OutputDependencies=true
- It does work from the IDE if you check “use MSBuild externally”
The msbuild property setting is available in at least Delphi/C++Builder versions 2007 and 2010..Berlin as it is in CodeGear.Cpp.Targets and CodeGear.Delphi.Targets/RTL.Build.targets for BDS versions 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 and 18. It might be available in versions 2005/2006/2009 as well but I don’t have these lying around any more.
–jeroen
Read the rest of this entry »
Posted in 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, QC, Software Development | Leave a Comment »
Posted by jpluimers on 2017/01/19
I had this error when building my Delphi app and needing detailed MAP files.
Somehow, then Delphi also tries to generate .drc files and fails.
Performing the “F2039 Could not create output file” drc – Google Search didn’t reveal much.
So I fired up Process Monitor and looked for file access patterns (see dump below), that all were OK.
Then I opened Windows Explorer and saw freshly generated .DRC files marked as some type of VLC Player file. I’ve had loads of trouble with VLC in the past, but I inherited this PC so I didn’t notice VLC Player was installed by the previous developer.
Lesson learned: when starting a gig, always request a fresh PC
So I uninstalled VLC Player and now everything works fine.
Oh btw: .DRC files are Delphi Resource String files.
–jeroen
Read the rest of this entry »
Posted in Delphi, Delphi 2007, Development, Software Development | 4 Comments »
Posted by jpluimers on 2017/01/10
A few weeks ago in When you get “TfsScript.Execute” throwing a “Unregistered version of FastScript.” I wrote about “a process that explains any modules in the MAP file not resulting in DCU files”.
The below batch file aids in that process.
It takes a MAP file from your Delphi compiled executable that has debug information in text format which means you need to set your project linker options to generate detailed MAP files.
The Map Debug File (*.map) – RAD Studio documentation hasn’t much information but points to Detailed-Segments Map File – RAD Studio which has a bit more. Neither contain information on Delphi units as they focus too much on the C++ side of things. Then there is a tiny bit information in Understanding Delphi MAP File – Stack Overflow.
So I did some spelunking and came up with this batch-file which will likely work back until about the Delphi 7 era:
Read the rest of this entry »
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 | 1 Comment »
Posted by jpluimers on 2017/01/05
Something to remember: Delphi To Go: Include resource files in your Delphi build process
Note it’s not enough to add a line like this to your .dpr file:
{$R 'New1.res' 'New1.rc'}
The resources actually needs to be part of your .dproj file (which basically is an XML msbuild file adhering to the MSBuild Project File Schema Reference).
That way, the BrccCompile target in $(BDS)\bin\CodeGear.Delphi.Targets will automatically pick it up during build.
I just checked and these target files support BrccCompile:
...\Embarcadero\RAD Studio\7.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\RAD Studio\8.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\RAD Studio\9.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\RAD Studio\10.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\RAD Studio\11.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\RAD Studio\12.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\Appmethod\13.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\Studio\14.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\Studio\15.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\Studio\16.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\Studio\17.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\Studio\18.0\bin\CodeGear.Delphi.Targets
Which means it’s available as of Delphi 2007 until at least Delphi 10.1 Berlin and might even work in Delphi 2006
It could be a little bit flakey in Delphi 2007 (I’ve had many msbuild issues there) but more recent versions should be fine.
–jeroen
Related: I have a big file to add +’ at the beginning of a line and ‘ at the end…- shlomo abuisak – Google+
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), 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, Resource Files and Scripts (.res/.rc), Software Development | Leave a Comment »