The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for the ‘Delphi’ Category

Poor mans C to Delphi converter by Wouter van Nifterick

Posted by jpluimers on 2018/01/18

Seems very OK for a first pass in a C to Delphi conversion:

[WayBack] Hi, I’ve created a C to Delphi converter.Because it’s been so useful to me that I’ve decided to share it.It converts C code as-you-type, and it keep… – Wouter van Nifterick – Google+

Source is on GitHub: https://github.com/WouterVanNifterick/C-To-Delphi

–jeroen

Read the rest of this entry »

Posted in C, Delphi, Development, Software Development | Leave a Comment »

Changing component class at run-time on demand for older Delphi versions need a bit more magic than you’d expect

Posted by jpluimers on 2018/01/16

Just in case I ever need to do heavy Delphi 2007 magic to change the component class of an object instance:

[WayBack] Quite unusual compiler behaviour (for older compilers) as seen here:http://stackoverflow.com/questions/41181767/patching-instance-class-requires-base-… – David Heffernan – Google+

References:

–jeroen

Source: Quite unusual compiler behaviour (for older compilers) as seen here: http://…

Posted in Delphi, Delphi 2007, Development | Leave a Comment »

Delphi: playing Chimes.wav as an external file or embedded WAVE resource in Delphi XE5.

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 [WayBackWAV 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 »

Damned ! var Comp : function(const s1, s2: string): Boolean; begin if CheckB…

Posted by jpluimers on 2018/01/10

One of my main gripes about lots of RTL/VCL/FMX code: conventions are often lacking.

Which means one of the below functions starts with Ansi (but does a Unicode operation) and the other has the parameters in reverse.

var 
  Comp: function(const s1, s2: string): Boolean;
  begin 
    if CheckBox1.Checked then 
      Comp := ContainsText 
    else 
      Comp := AnsiStartsText;
  end;

–jeroen

source: [WayBackDamned ! var Comp : function(const s1, s2: string): Boolean; begin if CheckB… – Paul TOTH +

Posted in Delphi, Development, Software Development | 2 Comments »

Autoregister attribute for Delphi | Jon L. Aasenden

Posted by jpluimers on 2018/01/10

Interesting idea:

[WayBack] Wouldn’t it be nice if Delphi has an attribute that automatically registers your class for you? – Lennart Aasenden – Google+

Source at [WayBackAutoregister attribute for Delphi | Jon L. Aasenden

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

Some FastMM scenarios require NeverUninstall because the System unit finalizes things innitialised in other units

Posted by jpluimers on 2018/01/09

You always have to be careful  with Delphi finalization sections cleaning up things that might have not created inside the corresponding initialization section. This is especially true for the System unit.

That one actually contains this little piece of code that is being called after FinalizeUnits is called which also fianalises external memory managers like FastMM:

finalization
{$IFDEF WEAKREF}
  InstHashMap.Finalize;
{$ENDIF}...
{$IFDEF MSWINDOWS}
 FinalizeLocaleDate;
 if PreferredLanguagesOverride <> nil then
 FreeMem(PreferredLanguagesOverride);
...

Which means that you will have to enable the NeverUninstall conditional define as soon as the InstHashMap has been used.

Most often that’s the case with FMX applications that heavily relies on weak references.

The same holds for PreferredLanguagesOverride which is used by SetLocaleOverride and can be worked around by performing this right at the end of the .dpr:

SetLocaleOverride('');

–jeroen

via:

Posted in Delphi, Development, Software Development | Leave a Comment »

Animation problems in Delphi Tokyo 10.2 update 2? Check bug RSP-19525

Posted by jpluimers on 2018/01/07

If you run into animation problems in Delphi Tokyo 10.2 update 2, then read [WayBack] … In particular I cannot use the use the animation to change the tab in a TabControl… – Raffaele Miola – Google+.

It is likely that  RSP-19525 (10.2 Tokyo Release 2 breaks Animation under Android – App hangs).

Some temporary fixes that might help you are here:

I think that for cross platform and especially mobile development means you need to use tools from vendors that live and breathe that, by constantly showing they master these subjects for instance having good apps in the app stores and examples that are regularly updated to the ever changing field.

I really wonder what the rest of the Delphi community thinks about that.

–jeroen

Posted in Delphi, Development, FireMonkey, Software Development | 1 Comment »

Record helpers can do wonders for code clarity.

Posted by jpluimers on 2018/01/04

A few people recently discovered the beauty of record helpers:

Record helpers can help any value type (which includes enumerated types) so you can add functions to enumerations.

Class helpers can help class types.

There are no interface helpers and likely won’t be there for a long while.

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Power User, Software Development | 2 Comments »

Delphi inner scoping is undefined. Please Embarcadero/Idera, come up with a formal language definition for Delphi

Posted by jpluimers on 2018/01/04

[WayBack] Hi there, this is pure curiosity only; but this compiler behaviour seems odd to me. What do you think?… – Agustin Ortu – Google+

The problems start when you prefix the outer class which you have to when using inner consts ([WayBack] Oh nice. Feel free to QP. Fails at least in Delphi XE8. … – Jeroen Wiert Pluimers – Google+).

The big problem in both cases is a formal language specification. The lack of a formal language specification makes it very hard to predict the effect of use cases or generate them for testing.

So this post is yet another request: Please Embarcadero/Idera, come up with a formal language definition for Delphi.

Read the rest of this entry »

Posted in Delphi, Development, Software Development | 2 Comments »

LAUNCHED https://uberpdf.org/

Posted by jpluimers on 2018/01/01

It is a lot (~300 megabyte compressed download!), but worth it.

Here are the links:

And the quote from [WayBack] LAUNCHED https://uberpdf.org/ … – Joe C. Hecht – Google+

LAUNCHED https://uberpdf.org/

337 MB of source and utils in 2,308 Files, 910 Folders before you build (not counting 3rd party source UberBuild downloads).

It’s a start, with much to come.It will get easier now that UberBuild is clean.

I will be updating the docs and website in the next few days.

Special thanks …

I already see room for improvement (such as a setup screen for extra compilers such as Delphi and Free Pascal to keep folks out of shell scripts and from hunting for help in the documentation).

–jeroen

Posted in *nix, C, C++, Delphi, Development, Linux, Power User, Software Development, Windows | 3 Comments »