Jump to content

David Heffernan

Members
  • Content Count

    3534
  • Joined

  • Last visited

  • Days Won

    175

Posts posted by David Heffernan


  1. 5 hours ago, aehimself said:

    Also please note that in Windows several environmental variables requires a logoff-logon for the changes to take affect (like %PATH%).

    Don't think that's true. That's the point of the broadcast message. The shell updates its environment and uses that when creating new processes. 


  2. 3 hours ago, Schokohase said:

    And my point is, you do not need to set the cursor if you have synchron long running code (because the OS will do for you) - so it only make sense to set the cursor when having code running async. 

    This approach is what you take when you hate your users. They can't tell whether or not your program is stuck in a non terminating loop, and the OS asks if you want to terminate the program. So only do this if you want to make your users suffer. 

    • Like 1
    • Thanks 2

  3. Don't change libraries and hope. The library you use is known to work well. There's a defect in your code. Work out what it is. Trial and error never works out.

     

    Provide a minimal yet complete program ideally a console app. Then you can hope for some help. 

    • Like 1

  4. OK, just looked tlat the documentation and it explains it all. You have to delete the sub keys. And you won't get an error in your code because the function returns a boolean indicating success or failure. You didn't check this. 

     

    Let me gently suggest that rather than tearing hair out, the documentation may help!


  5. Delphi is no easier than Java to learn.

     

    Delphi on mobile hasn't had the greatest track record. For instance at the moment there is no 64 bit Android compiler, thus locking delphi out of the app store. Yes there are temporary workarounds but it is not a great situation. 

     

    Embarcadero are struggling to keep pace with developments on the platforms that they attempt to support. 

     

    Quality has historically been a huge problem for Delphi. Both in their various compilers and related tooling, and their library code. They have a track record of releasing products and libraries that are full of bugs, and then spending many releases trying to fix them.

     

    The VCL remains a brilliant piece of work and for native Windows UI development it still excels.

     

    If I were you I'd widen the search. You say that you don't have time to learn a more difficult language. And that you want to start a business on the side. To be honest, those two statements don't sound very compatible. Making a business work takes a huge investment of time. Being a successful programmer demands mastery of tools and language. And that takes time. There are no shortcuts. 

    • Like 7

  6. No, it's using arctan2 rather than arctan.

     

    Just read every single other implementation on that page.

     

    As far as both sumsin and sumcos being very close to 0, I would still advise not using a tolerance.  All you can achieve by that is giving a less inaccurate answer than is possible to reach.

     

    If you want to do better, use one of the algorithms used for dealing with roundoff when calculating sums, for instance Kahan summation.


  7. 34 minutes ago, Mahdi Safsafi said:

    You don't need to convert Program2 into DLL. Just exports your functions and consume them directly from Program1 (just like DLL).

     

    
    // ========================================== Program1 ==========================================
    program Project1;
    {$APPTYPE CONSOLE}
    {$R *.res}
    uses
      System.SysUtils,
      WinApi.Windows;
    const
      Program2 = 'Project2.exe';
    type
      TGetProgram2Result = function(Param1, Param2: Integer): string;
    var
      LIB: HMODULE;
      GetProgram2Result: TGetProgram2Result = nil;
      s: string = '';
    begin
      try
        LIB := LoadLibrary(Program2);
        @GetProgram2Result := GetProcAddress(LIB, 'GetProgram2Result');
        s := GetProgram2Result(5, 2);
        Writeln(s);
        Readln;
      except
        on E: Exception do
          Writeln(E.ClassName, ': ', E.Message);
      end;
    end.
    
    // ========================================== Program2 ==========================================
    program Project2;
    {$APPTYPE CONSOLE}
    {$R *.res}
    uses
      System.SysUtils,
      WinApi.Windows;
    function GetProgram2Result(Param1, Param2: Integer): string;
    begin
      Result := Format('%d+%d=%d', [Param1, Param2, Param1 + Param2]);
    end;
    // ------------- EXPORTS -------------
    exports GetProgram2Result;
    begin
      try
        Writeln('This is Program2');
        Writeln(GetProgram2Result(5, 2));
        Readln;
      except
        on E: Exception do
          Writeln(E.ClassName, ': ', E.Message);
      end;
    end.

     

    Nope, that doesn't work. You can't expect to load an exe file with LoadLibrary. Also, even if you could, don't go exporting string across a module boundary.

     

    I'm astounded at all the posting here for a trivial problem with a standard solution.

×