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,262 other subscribers

Archive for March 28th, 2019

Not sure why, but sometimes the Delphi IDE does not allow you to toggle the Console Application; it looks off, but is in fact on: IsConsole returns true

Posted by jpluimers on 2019/03/28

On my research list: Not sure why, but sometimes the Delphi options display a regular application, but the IsConsole returns true because of AppType Console in the main PropertyGroup.

  1. console applications are turned off in the linker
  2. the debugger still shows it as a console application when stepping through the initialization section of the System unit

One of the problems is that unlike the {$APPTYPE directive (which has not changed much over time), the AppType element is undocumented (hardly anything in the .dproj file is documented).

The $APPTYPE lists two values: Console and GUI, defaulting to GUI:

Empirically, the AppType element can have these values:

  • Application
  • Console
  • Package

This is the topmost part of the .dproj file does not matter, without AppType element valued Console, or with it or even having it valued Application: either way a console application is being built.

There is no $APPTYPE in the .dpr or any of the .pas files.

The IsConsole variable is always false and a console window always appears when debugging.

That variable is not always conclusive, as there are situations where code is inside a BPL or DLL started by an EXE, so this works better: [WayBack] How to determine if I’m running as a console app? (Delphi on Win32) – Stack Overflow:

function IAmAConsoleApp: Boolean;
var
  Stdout: THandle;
begin
  Stdout := GetStdHandle(Std_Output_Handle);
  Win32Check(Stdout <> Invalid_Handle_Value);
  Result := Stdout <> 0;
end;

The .dproj files:

Read the rest of this entry »

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

Windows Manifest Files and Delphi

Posted by jpluimers on 2019/03/28

An interesting read on Windows Manifest Files in Delphi [WayBack].

TL;DR:

Do not let Delphi manage your manifest. All versions are either limited, or buggy, or both.

Basically it’s the same as doing VersionInfo in Delphi: do not let the IDE do it, but do it yourself. In this case:

Write your own manifest in XML, then load it as a resource.

Via: [WayBack] Blogged : Windows Manifest Files – In this post I look at Windows Manifest Files, what they do, why we need them and how to use them in Delphi and Finalbuilder… – Vincent Parrett – Google+

–jeroen

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

*Recursive Parallel For Loops*…

Posted by jpluimers on 2019/03/28

Interesting thread: [WayBack] Recursive Parallel For LoopsI have an algorithm which isn’t a sorting algorithm but conceptually works similar to the Quicksort algorithm… – Steve Maughan – Google+

TL;DR: when splitting recursive algorithms in parallel, ensure you have a way to hard limit the number of threads.

–jeroen

Posted in Development, Multi-Threading / Concurrency, Software Development | Leave a Comment »