The Wiert Corner – irregular stream of stuff

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

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

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

    Join 1,734 other followers

Archive for the ‘Delphi’ Category

FMX.Dialogs basically blocks mixing VCL with FMX…

Posted by jpluimers on 2017/04/27

Nice find:

Stefan Glienke+4

Look into the initialization block of FMX.Dialogs. The call to ActivateClassGroup(TFmxObject); turns off all the TRegGroups that don’t contain at least one type that inherits from TFmxObject which also happens to be the group that you register your form class to. GetClass then ignores such groups.

I don’t have the slightest idea what the intention behind all that code is but it certainly is one of the reasons why you cannot mix FMX and VCL officially.

In response to:

I have an VCL application. I need to register some form classes at run time. This is done in the form’s unit implementation section :

Initialization

If GetClass(‘TfmConnectiondialog’) = Nil Then
Classes.RegisterClass(TfmConnectiondialog);

Suddenly my class wasn’t registered anymore. GetClass(‘TfmConnectiondialog’) was always nil and Classes.RegisterClass had no effects.

After some long search, I’ve found that I’ve inadvertently added an FMX.Forms in one of my unit. This was the culprit. Replacing FMX.Forms with VCL.Forms solved my problem.

Behaviour is really strange, why Classes.RegisterClass didn’t throw any exception ? Is this a “Bug” or is this “as expected” ?

–jeroen

Source: Hello, I have an VCL application. I need to register some form classes at ru… [WayBack]

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE7, Delphi XE8, Development, Software Development | 1 Comment »

When BRCC32 throws `Fatal error Illegal macro definition in command line or defines page.` in a DUnitX project

Posted by jpluimers on 2017/04/19

I had a Fatal error Illegal macro definition in command line or defines page. thrown by BRCC32.exe in one of my Delphi projects.

As cgrc.exe could build the .rc file [source in Russian; WayBack], I reproduced it from the console with an Empty.rc file that has no content. That way I could rule out file content: now it had to be command-line arguments which is a different cause than any of the search results I found before.

My project was based on one of the DUnitX test projects. It ran in Delphi XE8, but the Delphi version doesn’t matter as BRCC32 hasn’t been updated since 1999.

Further below are the failure/success examples; this went wrong:

  1. DUnitX uses the DUNITX-DEBUG define to enable debugging of DUnitX itself in DUnitX.inc which also supports the DUNITXDEBUG define in the same area.
  2. Delphi will translate a .RC file in a project into a BRCC32.exe call adding the project conditional defines and search paths
  3. BRCC32.exe doesn’t like hyphens in conditional defines throwing a non-descriptive error Fatal error Illegal macro definition in command line or defines page.

So either removing DUNITX-DEBUG or changing it into DUNITXDEBUG solves the problem. Hence my pull-request.

Read the rest of this entry »

Posted in Delphi, Development, Resource Files and Scripts (.res/.rc), Software Development, Windows Development | Leave a Comment »

Jan Barendregt is Looking for programmers to maintain existing Excel add-in software

Posted by jpluimers on 2017/04/18

Jan Barendregt is Looking for programmers to maintain existing Excel add-in software.

The reason is no fun (cancer without curative treatment and prognosis till death likely months).

Please follow-up on the forum if you can be of help: [WayBackEmbarcadero Discussion Forums: Looking for programmers to maintain existing Excel add-in software

–jeroen

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

Delphi and the joy of Compiler Intrinsics – I cant use “Length” as a TFunc…

Posted by jpluimers on 2017/04/18

One of the reasons I favour using RTL based functionality over Delphi Intrinsic Routines like Length, Abs and others is that you cannot use compiler intrinsics in Generics. For instance Length is not compatible with TFunc<string, Integer> unless you declare it yourself like function StringLength(value: string): Integer; as otherwise you get en E2029 error (in this case the cryptic '(' expected but ';' found).

It’s one of the many areas where the Delphi compiler developers took a shortcut, but in this case I think the results are somewhat good.

Other reasons for using the RTL over compiler intrinsics have to do with scoping: the intrinsics are in the global scope which can clutter what you’re trying to work on.

So I much rather use the file and stream related functions when I’m actually working with a file or stream. For instance Assign for me has nothing to do with a file outside of a file context (it’s the reason AssignFile exists in the first place).

–jeroen

via: I cant use “Length” as a TFunc (tested in XE and XE6), but if…

Posted in Delphi, Delphi 10 Seattle, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 1 Comment »

When Delphi is missing the `ActiveX` items in the `File -> New` dialog

Posted by jpluimers on 2017/03/29

Marco Cantú posted the below solution when ActiveX is missing in your File -> New dialog which I’ve paraphrased:

OK, you can try this.

  1. Close RAD Studio/Delphi.
  2. Open the registry editor.
  3. Under HKEY_CURRENT_USER, open the Known IDE Packages\Delphi — that is something like HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\18.0\Known IDE Packages\Delphi
  4. Search for the delphicompro240.bpl, entry
  5. Edit it: remove the __ (double-underscore) pre-pended to the value (Untitled). In other word, change “__(Untitled)” into “(Untitled)“.
  6. Close registry editor.
  7. Open the IDE.

I ran it it recently and was glad this worked.

–jeroen

Source: Hey! I have a new Delphi :)…Great!  And what to do now with my favorite…

Posted in Delphi, Delphi 10.1 Berlin (BigBen), Development, Software Development | Leave a Comment »

 
%d bloggers like this: