Jump to content

Jud

Members
  • Content Count

    153
  • Joined

  • Last visited

Posts posted by Jud


  1. I write some programs in Delphi that make heavy use of the CPU for a long time.  I used to use Windows 7, 8, and 10 on Sandy Bridge, Ivy Bridge, and Haswell i7 CPUs, with four hyperthreaded cores.  For multitasking, I could get 98% CPU usage.

     

    Now I'm using Windows 11 on 12th-14th generation i7s, with eight hyperthreaded P-cores.  But I cannot get more than about 40% CPU usage with 16 threads running.  I look at Task Manager and Process Monitor, and see the under-utilization of the CPU. I have the power setting set for high performance.

     

    What caused this loss in performance - Windows or the new CPUs?  And is there a way to utilize most of the CPU?  

     


  2. It didn't show up on Getit (I noticed it on the Welcome page yesterday) - I did a complete install.  I was having so many problems that I couldn't get work done, so I went back to the original 12.2.

     

    But I had many problems getting the patched version installed.  It locked up several times, and I had to reboot.

     

    ------------------

    Also, will they ever be able to transfer your settings to a new installation?  I had to set all of the options twice yesterday.


  3. I added it manually because before when I clicked on "OnCloseQuery" in the form's inspector, it would not let me add it there, like the form OI usually does. But now it does, and is working.  (I don't remember the error message I got when I tried c;licking on the event OnCloseQuery before.)

     

    Thanks for the replies!


  4. I want to show a confirmation question before closing the main form by clicking on the "x" in the upper right corner.  The following is based on Delphi help, the example given in a link in tform.OnCloseQuery help.

     

    It used to work in another program but it doesn't work in my current program.

     

    I put "procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);" in the form's class.

     

    Then I have this, based on the example:

    procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
    if MessageDlg( 'Do you want to exit the program?',
                        mtConfirmation, [mbYes, mbCancel], 0) = mrCancel
      then CanClose := false;
    end;

     

    The program starts and then I click a button to start some tasks.  If I click on the "x" before the tasks are started,
    it closes immediately.  If I do it after the tasks have started, it closes immediately if it is running from the EXE.  
    If it is running from the IDE, it gives an access violation.

     

    What do I need to do to make it behave as intended (i.e. confirm before closing the form.)


  5. If I remember correctly, VCL ProgressBars used to show the percentage, in numerals.  I'm trying to add one to a Delphi 12.1 project, and it isn't showing the percentage.  I looked at the properties but I didn't see any that seemed like it would turn on the display of the percentage.

     

    Is there a way to show percentage on a TProgressBar in Delphi 12.1 VCL?


  6. 1 hour ago, Ian Branch said:

    GExperts works fine in D12...

    I was going to the old website and I didn't notice that it is now done by someone else with a different website.  I just downloaded it - thanks for telling me that.

     

    * I have it installed, but I can't find an option to prevent a second instance of the IDE from starting.  Where is that option?


  7. 9 hours ago, dummzeuch said:

    I'm not aware of such a warning in Delphi, but GExperts shows one. It's enabled by default and can be disabled in the dialog itself. To enable it again later, go to the messages tab in the GExperts configuration dialog.

    I used GExperts for years, but it doesn't work with Delphi 12,   That was probably what I was using.


  8. It used to be that if I started a second instance of the Delphi IDE, it would warn me and ask if I wanted to start another instance.  Now it doesn't ask - I sometimes have 2, 3, or 4 instances running inadvertently, which I want to avoid.  I got a new computer with Windows 11 instead of 10, and I've upgraded Delphi. 

     

    Is there a setting in Delphi that warns you about starting a second instance?  Is it a Windows setting? (I know how to keep a second instance of my program from running.)


  9. I'm having a strange problem in the Delphi 12 IDE on a Windows 11 desktop.  First I downloaded the trial version of Enterprise and entered my license number.  (My license is for the professional edition.) There were strange problems in the IDE.  When searching, if I searched for "xyz[" or "xyz(", it would give an error message about mismatched [ or (, and not search.  If I search for ".xyz", it ignores the period.  There are other things, like much of refactor is disabled.  Sometimes "find declaration" doesn't work.

     

    I uninstalled Delphi 12 and reinstalled it from the iso file.  I had the same problems.

     

    Then about 3 weeks ago I installed it on my Windows 11 laptop to take on a trip.  It DOES NOT have the problems!

     

    What could cause this and how can it be fixed?

     

     


  10. 10 hours ago, DelphiUdIT said:

    I think that with regular account (subscription active) you cannot use CE.

     

     

    That seems to be the case, based on my experience.  I don't want to go through the hassle of activating it on my laptop, so I'm planning to use my wife's email to get the CE on my laptop. 


  11. I'm a long-time registered user of Delphi.  I want to download Delphi Community Edition to my laptop to take on a trip.  When I download the community edition, it gives me three options: sign up for trial version, enter a registration key, or upload a registration file. I just want to use the free community edition, but that isn't an option.  When I enter my registration code for 11.3, it says that it is registered to a different user, so I can't register it.

     

    Is there a way for me to just get the community edition for my laptop?


  12. 15 hours ago, Jud said:

    I've had a perplexing problem for about 2 days. Basically if a tTask is inside a loop, the loop isn't executed. I extracted a section of code from my program, and the short sample code below has the problem.  After the SetLength line is executed, it goes to the END of the procedure.  

     

    ==================

    More information:

     

    1. Sometimes the demo works. 

     

    2. But when that isn't working, the program skips the loop (doesn't even go to the FOR statement) and goes to the END of the procedure.  Then it locks up big time.  After a few seconds, it gives a stack overflow message, and it points to various places in System units (there doesn't seem to be a pattern).  It locks up so bad that I can't Close Window or end it with the task manager.  I have to restart the computer.

     

    3. I remembered that you can't call a procedure that depends on the value of the loop counter that way.  The only way I know to do it is to call a procedure from within the loop and that procedure sets up task and runs it.  So I'm going to make that change and I expect it will fix the problem.

     


  13. I've had a perplexing problem for about 2 days. Basically if a tTask is inside a loop, the loop isn't executed. I extracted a section of code from my program, and the short sample code below has the problem.  After the SetLength line is executed, it goes to the END of the procedure.  

    This used to work.  If I take the line TaskArray[ counter] := - the loop is executed. If I take out the loop and replace it by counter := 0, it works.

    Am I missing something?  What is going wrong?


    procedure TForm2.RunButtonClick(Sender: TObject);

    const NumberOfParts = 1;

    var counter : integer;
        TaskArray : array of iTask;

    begin { --- run button --- }
    SetLength( TaskArray, NumberOfParts);

    for counter := 0 to NumberOfParts - 1 do
    begin
      try
        TaskArray[ counter] := tTask.run( procedure
          begin
            RunWork( counter);
          end);
      except on E:EAggregateException do ShowMessage( E.ToString);
      end; // try
    end; // for counter
    end; { --- run button --- }

     


  14. 6 hours ago, programmerdelphi2k said:

    I think that "ProcessMessages" it's not necessary.

    you can use "Synchronize" (wait me ...)  or "Queue" (dont wait me ...)

    5 hours ago, Dalija Prasnikar said:

     

    You should remove Application.ProcessMessages from that code as it serves no purpose. 

     

    I took that out. 

    Also, I just realized that I made a mistake.  I was using tThread.synchronize in one place and tThread.queue in another place, writing to the same memo, and the data was not matching.  It seems that thread.queue is NOT thread-safe for doing this.

     

    It is working now, thanks everyone!

     


  15. I need to write to a memo on the main form from within a thread.  In an old program using tasks I was doing this:

     

    tThread.synchronize( tThread.current, procedure
    begin
      form1.TestMemo.lines.add( 'Testing ');
      application.ProcessMessages;
    end);

     

    and it was working.  I put the same type of thing in a tread called by the parallel for, but it isn't writing to the memo. 

     

    Is there a different way to do it from a thread called from a parallel for? 

×