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 2,091 other followers

Archive for the ‘Conferences’ Category

Delphi XE6 .. 10.1 Berlin truncating non-VCL-control texts to 256 characters when styled

Posted by jpluimers on 2020/09/23

As of Delphi XE6, the VCL also styles non-VCL controls, but this truncates the texts to 256 characters, for instance in non-balloon hints. This is fixed in Delphi 10.2 Berlin, by making the buffer dynamic and switching obtaining those texts from using GetWindowText to sending a WM_GETTEXT message.

A fix for Delphi XE6..10.1 Berlin is at gitlab.com/wiert.me/public/delphi/DelphiVclStylesAndHintText, with many thanks to Stefan Glienke who based the patch on the ones used in Spring4D. I think they are similar to the ones in [Archive.is] VCL Fix Pack 1.4 | Andy’s Blog and Tools.

The Old New Thing explains the difference between GetWindowText and WM_GETTEXT in [WayBack] The secret life of GetWindowText – The Old New Thing. TL;DR:

GetWindowText strikes a compromise.

  • If you are trying to GetWindowText() from a window in your own process, then GetWindowText() will send the WM_GETTEXT message.
  • If you are trying to GetWindowText() from a window in another process, then GetWindowText() will use the string from the “special place” and not send a message.

So for your own process, it does not matter as GetWindowText uses WM_GETTEXT.

–jeroen

Related:

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development, The Old New Thing, Windows Development | Leave a Comment »

Delphi Gem of the day: putting “reintroduce” on a destructor. destructor…

Posted by jpluimers on 2020/09/22

A nice thread with examples of all the things you should not do with the Delphi reintroduce keyword:

[WayBack] Delphi Gem of the day: putting “reintroduce” on a destructor.     destructor Destroy(); reintroduce; overload; In our case all we got was a memory lea… – Moz Le – Google+

The problem is that in the original (archived) documentation, not much waring is given around using reintroduce; it is merely posted as solving a nuisance to absolve a compiler warning.

When using it though, all your alarm systems should go off at their highest level as you break polymorphism, but through careful language usage, the pattern you hide can still be used.

One day I will write a longer blog article on this.

Documentation:

A decade of progress has not changed much on this documentation apart from some nicer formatting:

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »

Delphi: TInvokableClassRegistryHelper.GetInterfaceNamespace as the opposite of TInvokableClassRegistry.RegisterInterface

Posted by jpluimers on 2020/09/17

A while ago, I needed the opposite of InvRegistry.RegisterInterface(TypeInfo(MySoapInterfacePortType, 'urn:myURN', 'utf-8');, so instead of registering an interface with a namespace URN, obtain the URN by passing the interface inverting [WayBack] TInvokableClassRegistry.RegisterInterface.

This is the class helper I wrote:

type
  TInvokableClassRegistryHelper = class helper for TInvokableClassRegistry
  public
    function GetInterfaceNamespace(Info: PTypeInfo): string;
  end;

function TInvokableClassRegistryHelper.GetInterfaceNamespace(Info: PTypeInfo): string;
var
  InfoGuid: TGUID;
begin
  // call like `Result := InvRegistry.GetInterfaceNamespace(TypeInfo(MySoapInterfaceType));`
  InfoGuid := GetTypeData(Info)^.Guid; // uses TypInfo; see https://stackoverflow.com/questions/8439246/is-it-possible-to-get-the-value-of-a-guid-on-an-interface-using-rtti
  Result := GetNamespaceByGUID(InfoGuid);
end;

It would have been a lot easier if TInvokableClassRegistry.GetIntfIndex has been public, because then [WayBack]TInvokableClassRegistry.GetRegInterfaceEntry could have been used.

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, SOAP/WebServices, Software Development | Leave a Comment »

FreePascal downloads I used to get Web Service Toolkit to compile since the Delphi WSDL importer has braindead include support

Posted by jpluimers on 2020/09/11

The Delphi WSDL importer maintenance has been in dormant mode for a long while, which means it still barfs on WSDL include directives.

In the day and age of REST and gRPC, I don’t think it will get any love soon.

Related bug entries are for instance RSP-18630: WSDL generate bad code and RSP-17321: “Import WSDL” generates invalid code without explanation of problem are examples of this, and I’m sure that QC had more if it were still alive; I could find these in the WayBack machine:

The problem manifests itself when the WSDL file includes one or more XSD files. The generated code will contain a section like this:

  // ************************************************************************ //
  // The following types, referred to in the WSDL document are not being represented
  // in this file. They are either aliases[@] of other types represented or were referred
  // to but never[!] declared in the document. The types from the latter category
  // typically map to predefined/known XML or Embarcadero types; however, they could also 
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //

Further below is a series of commented out types, all starting with a ! end ending in a column with the namespace of those types.

Searching for the first line gives numerous examples as far back as Delphi 7, for instance:

Based on those, I think the reason is that the WSDL importer fails on <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> which is quite common in the real world.

I did not want to pursue manually modifying the WSDL file, or manually generating the types as the WSDL and XSD files were prone to changes and manual steps would make the re-import process more tedious. If you do want to do that, these link might help:

This is what I used to get this to compile and run [WayBack] Web Service Toolkit – Free Pascal wiki:

Build steps

FPC installation

  1. Run the 32-bit installer
  2. Keep all options except on the second install screen, disable Associate .inc files with FreePascal IDE
  3. Add C:\FPC\3.0.4\bin\i386-win32 to the user path

Building

  1. Recursively unzip wst-0.7u.zip
  2. Open a command prompt in the wst-0.7u directory
  3. Verify there is a ws_helper subdirectory

When compiling in Delphi, then you definitely need the FreePascal RTL sources for the PasTree unit; see [WayBack] fcl-passrc – Free Pascal wiki.

Related:

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | 1 Comment »

Recursive loop, see loop, recursive

Posted by jpluimers on 2020/09/09

Recursion explained visually.

Via [WayBack] Wenn mehrere Generationen in den Feiertag / Vatertag starten.

[WayBack] Original picture at [WayBack] Bug Life | Chickie’s Rides | Pinterest | Vw, Volkswagen and Cars.

–jeroen

 

Posted in Conference Topics, Conferences, Development, Event, Fun, Software Development | Leave a Comment »

 
%d bloggers like this: