Jump to content

uligerhardt

Members
  • Content Count

    97
  • Joined

  • Last visited

Posts posted by uligerhardt


  1. In the attached project, the internal manifest is disabled in the project options. Instead an external manifest is supplied (ExternalManifestTest.exe.manifest).

     

    Now if I compile the project and run it from explorer, the main form shows up themed as expected.

    If I rename the manifest and run the app again, it shows up unthemed - again as expected.

    Now if I restore the manifest's original name and try again, the app still appears unthemed - not expected.

    To make it recognize the manifest again, I have to change the date of the exe file (by recompiling or using something like "touch").

    (Windows 11, Delphi XE6)

     

    Why is this and how can I change it?

    ExternalManifestTest.7z


  2. 3 hours ago, Anders Melander said:

    Okay, so I would recommend that you simply start with the RTL TThread. Mainly because it appears that you have no prior threading experience (or you probably wouldn't have asked in the first place) and it would be best to learn the basics before trying something more advanced. Threading might seem easy but it's actually really difficult if you don't know and understand the many things that can go wrong.

     

    I would also avoid the various 3rd party threading libraries, even though I'm sure they can do some nice things, so you don't introduce external dependencies and get locked in to their way of doing things. Once you know a bit more you can make an educated decision about which way to go.

     

    The PPL was introduced in XE7 but I think it took a while for it to become reliable(ish). I stayed clear of all the versions between XE2 and Delphi 10 so I don't have first-hand experience with those versions. These days I seldom use TThread directly. Most of my thread tasks are short lived so they benefit from the TTask thread pool (and TTask is just so much nicer to use).

    I did some threading experiments with TThread but in a more complicated situation and dropped that - I would have had to accept user input in dialogs during the thread.

    For my current needs handing a anonymous procedure to the thread should suffice, I think. So I'll try TThread again.

     

    Thank you all for answering to my not very well prepared question.


  3. Hi all!

     

    I have some kind of dashboard/action central that provides a host of different buttons. All of these start an independent task and display progress info about that task (in a tree view). Currently this is handled without threading, so the dashboard is blocked until the task is finished.

    Therefore I'd like to make these tasks into threads.  What threading library would you recommend? TThread, Andreas Hausladen's AsyncCalls, OmniThread or something different?


  4. 14 hours ago, David Heffernan said:

    Does it even compile, and if so what does it mean? 

    My fragment wouldn't have compiled. And as stated I'm not sure if it helps with this:

    On 9/27/2024 at 6:16 AM, Tommi Prami said:

    Make sure, some constant is always Double, not extended, in 32bit and also in 64bit...

    That might depend on the scenario. IIRC this syntax is used in the RTL/VCL code - can't check right now.


  5. 34 minutes ago, Vandrovnik said:

    The new unit order can have unintended side effects - if two unites define procedures with the same names and their order is swapped, the code will use a different procedure than before (such as System.Math and Neslib.FastMath do).

    This would only apply if we're rearranging the used units inside a pas file. My question is about the project file, where you typically don't have much code.


  6. 40 minutes ago, Anders Melander said:
    • Sorted by dependency
    • Sorted by "some other criteria"

    Pick one

    These are not mutually exclusive. E.g. PAL gives something like

    BusinessLogicA
    ThirdPartyA
    MyBaseStuffA
    BusinessLogicB
    ThirdPartyB
    MyBaseStuffB

    which satisfies the first bullet. I'd like to have

    ThirdPartyA
    ThirdPartyB
    MyBaseStuffA
    MyBaseStuffB
    BusinessLogicA
    BusinessLogicB

    which satifies both criteria. I guess this would be some kind of stable sorting based on the original uses order.


  7. If you don't want to change the order of parameters you can use two overloaded  functions like this:

    interface
    
    function GetWeekDates(const GivenDate: TDateTime; const SOWDay: string; out startDate, endDate: TDateTime): Boolean; overload;
    function GetWeekDates(const GivenDate: TDateTime; out startDate, endDate: TDateTime): Boolean; overload;
    
    implementation
    
    function GetWeekDates(const GivenDate: TDateTime; const SOWDay: string; out startDate, endDate: TDateTime): Boolean;
    begin
      //...
    end;
    
    function GetWeekDates(const GivenDate: TDateTime; out startDate, endDate: TDateTime): Boolean;
    begin
      Result := GetWeekDates(GivenDate, 'SU', startDate, endDate);
    end;

    Alternatively, drop the overload and use different names like GetWeekDates and GetWeekDatesEx.

    • Like 1

  8. 28 minutes ago, Uwe Raabe said:

    Unfortunately that is by design as comments in uses clauses are considered not clean.

     

    Background: It is pretty hard to connect the comment to one of the used units - there is too much convention involved with this. Also, line end comments don't play well with grouping and line wrapping.

     

    There are non plans to change this any time soon.

    Thanks for the info, Uwe - I already suspected this. Fortunately, it's not a big problem. 


  9. Hi all,

     

    I recently started using UsesCleaner and mostly love it. One mildly annoying aspect is that it removes comments after units in the uses clause. I often have clauses like

    uses
      Unit1, // PALOFF - to suppress false positives from Pascal Analyzer 
      Unit2, // used because of some obscure reason
      Unit3; // TODO remove when ...
    

    and have to reinstate all the comments after using UsesCleaner. Is there a way to make UsesCleaner leave the comments in place?

×