-
Content Count
3534 -
Joined
-
Last visited
-
Days Won
175
Posts posted by David Heffernan
-
-
Did you do any debugging? Did you check that the registry was modified as intended?
Reference back to https://docs.microsoft.com/en-gb/windows/win32/procthread/environment-variables
-
You code runs the risk of hanging when it broadcasts. But the basic concept is correct albeit poorly implemented. Have you done any debugging?
-
On 9/9/2019 at 8:16 PM, Clément said:This might shed some light:
The answer in that link appears factually misleading at best, probably downright incorrect.
-
Provide a minimal complete reproduction.
-
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.
-
1
-
2
-
-
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.
-
1
-
-
4 hours ago, Mike Torrettinni said:Interesting, although I only change cursor to HourGlass and back. That Try.. finally looks odd, being used just for the cursor.
Why would that be odd? That's pretty much a canonical use of try finally.
-
3
-
-
Jokes aside, any user that feels that the testing could be broadened can write some tests and submit a PR.
-
2
-
-
Tested 42 and Lorem ipsum, that seems pretty complete to me. 😉
-
1
-
4
-
-
11 minutes ago, FredS said:Maybe you need to use a WOW key: Accessing an Alternate Registry View
No. It's in HKCU.
-
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!
-
Don't you need to empty the key before you delete it?
-
Is the key empty?
-
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.
-
7
-
-
Dude, before my time. Also, how we miss Rob Kennedy from the Delphi world.
-
1
-
-
But they have a much wider scope. Not a problem if your units have only one class. But with many classes it can be an issue.
-
Nested methods are one of the biggest things stopping me porting my code to C++.
-
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.
-
Actually the comparison against eps is wrong and should be removed. Call arctan2 unconditionally. Also the divide by cnt is utterly wasteful.
Bogus comparisons against small numbers drive me mad.
-
1
-
-
The const param reference counting bug that keeps on giving.
https://stackoverflow.com/a/31028671/505088
https://stackoverflow.com/a/7640979/505088
https://stackoverflow.com/q/4509015/505088
QC report 90482 and presumably many others. Of course, Emba killed QC. Thanks so much for that. Can I be arsed to re-enter all the unsolved reports that were killed when QC was killed? No I cannot.
-
1
-
-
Not so much humour as a comment about the arrogance of imagining that the big company can just decide to buy the small company. Perhaps the small company is happy to be independent.
-
3
-
-
7 hours ago, RDP1974 said:So is better if emba buy remobjects and leverage the big quality of their llvm Island for the whole new platforms
Perhaps they could buy Greenland as well
-
12
-
-
6 minutes ago, Mahdi Safsafi said:You can use LoadLibrary with exe file ! The only things is that you need to keep an eye on initialisation.
No. Because there is no DllMain and so nothing is initialized. And then there are the lack of relocations.
What's wrong with Delphi programmers. Read the standard output already!
-
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.
Setting Environment Variables
in Windows API
Posted
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.