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 4,224 other subscribers

Archive for April 4th, 2019

Detecting if a debugger is present is different from detecting if an IDE is present.

Posted by jpluimers on 2019/04/04

I have seen this happen in various environments: people wanting to detect if their debugger is present, but trying to detect their IDE, or vice versa.

Similar reasoning is for detecting for being running on a console, or your project having been built to run on a console.

People use these decisions, for instance to determine if their application should behave as a service, or as a regular process.

Ways to determine the various permutation points:

  • Running inside a debugger: use the [WayBackIsDebuggerPresent function (which can be true, even if Delphi DebugHook stays zero).
  • Check for the IDE: tricky; as IDEs have different behaviour over time. For Delphi, check for any TAppBuilder Window class with the [WayBack] FindWindow function.
  • Compiled for console: for Delphi check IsConsole, for .NET I could not find good information.
  • Running on a console: check if you can allocate a handle to stdout
  • Running as a service: check the hosting assembly or hosting process

Related links:


Posted in .NET, Delphi, Development, Software Development, Windows Development | Leave a Comment »

Firemonkey/Isometric at master · tothpaul/Firemonkey

Posted by jpluimers on 2019/04/04

This shows you how to do 2.5D isometric projection in Delphi using Firemonkey: [WayBackFiremonkey/Isometric at master · tothpaul/Firemonkey.

[WayBackIsometric projection – Wikipedia.

Via: [WayBack] I wonder what the best approach would be to use FireMonkey to develop an isometric 2.5D game in the “classic” way… – Fl Ko – Google+


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

Delphi: do NOT use duplicate GUIDs on interfaces

Posted by jpluimers on 2019/04/04

One of the things when fixing bugs in an old codebase is wading through technical debt.

A quick win is to get rid of duplicate GUIDs when interface portions have been copy-paste re-used:

  1. interfaces with the same GUID are treated the same with as casts even if they are different.
  2. the compiler does not warn about duplicate GUID values**

These searches help big time: it shows the duplicate GUIDs if they have been indented all the same way. Good enough for most situations.

grep -Sh "\[\'{" *.pas | sort

grep -rh "\[\'{" *.pas | sort

It depends which flavour of grep you use (gnu or regular) to specify recursion.

Note that findstr doesn’t cut it as it always shows the filename: [WayBackList files recursively showing only full path and file size from Windows Command Prompt – Super User

** this compiles without warning:

program NoWarningOnDuplicateInterfaceGUID;


{$R *.res}


  IInterface1 = interface

  IInterface2 = interface

  Subject: IInterface;
    (Subject as IInterface1)._Release;
    (Subject as IInterface2)._release;
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);


Read the rest of this entry »

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

%d bloggers like this: