Archive for the ‘Delphi 2010’ 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/11/01
Need to research {$DUPLICATEENABLE ON} further one day, but surely looks useful but is not really documented, not even at the Delphi 2009 documentation where it was introduced: [WayBack] SysUtils.pfIgnoreDupUnits Constant.
–jeroen
Via: [WayBack] MonkeyMixer has just been updated!- I’ve fixed a unit naming collision with Castlia- I’ve added an XE7 project group (which includes both the BPL and… – Simon Stuart – Google+
PS:
A cryptic G+ comment [WayBack] by Uwe Schuster:
DUPLICATEENABLE is old, but since it is something for IDE packages to avoid intersections with user/3rd party packages there is no need for a documentation. I do use it in an IDE package that did use the JCL/JVCL units as well and does another unit with a common name. IIRC I did mention it related to MonkeyMixer.
I think he argues that documentation is both not needed, but the usage of the directive sometimes is. Which somehow feels like a contradiction to me.
PS2: via Stefan Glienke, an error message that is related to this:
---------------------------
Error
---------------------------
Cannot load package 'Package2.' It contains unit 'Whatever', which is also contained in package 'Package1'.
---------------------------
OK
---------------------------
Posted in Delphi, Delphi 2009, Delphi 2010, 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/08/31
If you want to set all columns to the same value, select all columns in the structure view and then (assuming SizeStyle [WayBack] is already set to ssPercent [WayBack]) set the Value [WayBack] to 0. This will trigger some automatism that makes all of the columns sized equal.
Great answer by Uwe Raabe [WayBack]
Source: Delphi How to use TGridPanel – Stack Overflow [WayBack]
–jeroen
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), 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/08/08
Thanks Stefan Glienke for posting this a while ago:
If you ever wonder why you get no (or incomplete) RTTI from a control that you inherited from a DevExpress one – then look into cxVer.inc where it has the following lines:
{$IFNDEF CXTEST}
{$WEAKLINKRTTI ON}
{$RTTI EXPLICIT METHODS([]) FIELDS([]) PROPERTIES([])}
{$ENDIF}
+Martin Wienold was wondering (and so was I at first) why he could not properly resolve a form from the DI container that inherited from TdxRibbonForm despite writing a public method with [Inject] attribute on it but it was never called.
Warning: If you are using DevExpress or any other source code that does this (changing the $RTTI directive) and build these sources together with your application (in contrast to using precompiled dcus or even packages) on a version <XE6 then you might suffer from this issue: [WayBack] #79943: {$ RTTI} flag scope which causes RTTI to disappear even from units that did not have the $RTTI in them.
Source: If you ever wonder why you get no (or incomplete) RTTI from a control that you…
–jeroen
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2009, Delphi 2010, Delphi x64, 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/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/28
[WayBack] New book by +Nick Hodges tech preview by +Stefan Glienke https://leanpub.com/dependencyinjectionindelphi – via Jeroen Wiert Pluimers – Google+:
This book covers Dependency Injection from A to Z. In it you’ll learn about Constructor Injection, Property Injection, and Method Injection. You’ll learn about the right and wrong way to use the Dependency Injection Container.
Source: Dependency Injection In Delphi by Nick Hodges [Leanpub PDF/iPad/Kindle]
This is the Chapter List:
- What is Dependency Injection
- Benefits of Dependency Injection
- Constructor Injection
- Property Injection
- Method Injection
- Using the Container
- A Simple Migration Example
- Advanced Uses of the Container
- Dependency Injection Anti-patterns
- A Full, Useful Example
- Final Thoughts
–jeroen
Source: New book by +Nick Hodges tech preview by +Stefan Glienke https://leanpub.com/…
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), 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/02/23
the release of 1.2 is almost there! We are working hard to deliver it shortly after the next Delphi release which will happen … soonish, I think. ;)
The release/1.2 branch has been around for a while – please take a look if you haven’t already. It contains a lot of new features and bugfixes. I will tell you more about some of the amazing features next time which won’t take as long as it took since the last blog post – promise. :)
Apart from a very interesting take on DI resolvers, the above great info too!
Please take a look at spring4d/branch/release/1.2 as it has been very stable for quite some time.
Source: [WayBack]: Delphi sorcery: Generics, modules and typeinfo
–jeroen
via: [WayBack] Finally some blog article again ;) – Stefan Glienke – Google+
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »