

Der schöne Günther
Members-
Content Count
731 -
Joined
-
Last visited
-
Days Won
12
Everything posted by Der schöne Günther
-
Custom sort of a TList with object references (works in 32 bit, does not in 64 bit)
Der schöne Günther replied to Alexander Halser's topic in Algorithms, Data Structures and Class Design
It's not TList<T> from System.Generics.Collections. It's the age-old TList from System.Classes. Straight from the documentation: System.Classes.TList.Sort - RAD Studio API Documentation (embarcadero.com) -
generics Destructor of Object in TObjectList<k,v> never gets called despite doOwnsValues
Der schöne Günther replied to omnibrain's topic in Algorithms, Data Structures and Class Design
Not trying to be a smartass, but doesn't the compiler warn you explicitly? Like -
How can I create a smith chart in c++ Builder 11.3 Alexandria
Der schöne Günther replied to kerravon99's topic in VCL
I am not familiar with that kind of chart, but TeeChart for VCL has it. smith.png (919×526) (steema.com) You will need to acquire the Pro version. Steema | Feature Matrix TeeChart VCL / FMX -
Why does a stack overflow cause a VCL application to terminate?
Der schöne Günther posted a topic in RTL and Delphi Object Pascal
Consider this complete VCL application (Form1 & Button1): unit Unit1; interface uses System.SysUtils, System.Classes, Vcl.Forms, Vcl.StdCtrls, Vcl.Controls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} procedure causeStackOverflow(); begin causeStackOverflow(); end; procedure TForm1.Button1Click(Sender: TObject); begin causeStackOverflow(); end; end. Clicking the button causes the application to hang for a bit, then the debugger will break on a EStackOverflow exception. That's totally expected. But directly after that, the application tries to display its regular error dialog, causing an access violation and then silently crashing. This is the callstack: It will then cause an access violation in user32.dll repeatedly and then crash. I have no idea why. 64 Bit is fine, by the way. It just happens with 32 Bit .exe. -
Why does a stack overflow cause a VCL application to terminate?
Der schöne Günther replied to Der schöne Günther's topic in RTL and Delphi Object Pascal
Good catch, it does. Absolutely, but I expected it to recover from it by popping the stack to the next exception handler and proceeding as usual. Does that mean a stack overflow in the main thread should generally be seen as non-recoverable and game over? -
Getting the command line parameters of an executable
Der schöne Günther replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
Why? I think that is actually a pretty decent way. -
Sounds like this here to me: https://quality.embarcadero.com/browse/RSP-40939
-
You need to get familiar with how TWebBrowser works. It can either use Internet Explorer or Microsofts Chromium-based "WebView2" runtime, if it is installed and your application has the "WebView2Loader.dll" in its path. If you are using Internet Explorer mode (and probably running in IE 7 mode), then you are correct, it will still show vertical scrollbars although the CSS says otherwise. In that case (if you really want to stick with the old Internet Explorer mode), you will need the non-html conforming <body scroll="no"> which Internet Explorer will understand:
-
Many thanks, that ist most helpful. I'll give it a read. I remember a system completely hanging up because one process had hundred thousands of handles it didn't close properly, then spawning a child process and trying to inherit all handles to it.
-
A ready to use solution (which I have never tried) is TurboPack/DOSCommand: This component let you execute a dos program (exe, com or batch file) and catch the ouput in order to put it in a memo or in a listbox. (github.com) It is said to be available throught "GetIt" as well. For myself, I did it as also suggested by this fine gentleman here For the processes I spawn myself (via CreateProcess()), I just create two pipes and then use WriteFile(..) and ReadFile(..) on them. It is important that CreateProcess(..) has its "inherit handles" parameter to true. If you're stuck, I might post my solution, but it contains a a lot of noise as well (such as moving the created process to a "job object" to allow easier resource scheduling or termination)
-
There is plenty of examples on how to do this with Delphi, you already got the correct term: It's (inter-process) communication (IPC) via "pipes". I'd recommend to start a bit more humble by making a small console app by yourself that will, for example, take two numbers from the input, and return the sum of these two numbers. Then, try sending these two numbers to your console app and getting the result back. If that works, you can do that with your free pascal compiler. By the way: Cmd.exe is nothing more than a front-end that just does what your application wants to do. You don't need to "connect" to a cmd.exe. You will directly launch and communicate with your free pascal compiler.
-
So what? Also, the web browser for "surfing the internet" got nothing to do with how you want to display PDF files within your application. You should get familiar with the WebView2 runtime for your trusty old TWebBrowser. I'd strongly recommend.
-
Why don't you just use a WebView to display the PDF? It can enable/disable zoom by gestures/touch/hotkeys, and set the general zoom level, but I think it cannot zoom in on a specific part of the PDF, like you can with two fingers on a touchscreen.
-
Instead of these hacks, why don't you just disable scroll bars by CSS?
-
You probably might want to read the "Important note about DLL memory management" you just posted.
-
Thank you for your experience. I couldn't have told.
-
Exactly the same configuration I am also considering. If you have something to share about your experience, please do tell.
-
Can you give a rough estimate what you consider "enough" for both RAM (probably 16+ GB) and disk? I am not familiar with Parallels, and how its VMs tend to grow in size. PS: I found it surprisingly convenient to go the other way: Use the Mac as my main computer and remote into an old PC (hosting my Delphi Hyper-V machines) for doing Delphi stuff.
-
Haven't tried to run it, but looks legit to me. You will call add_StateChanged(..) to then monitor for the value to become COREWEBVIEW2_DOWNLOAD_STATE_COMPLETED. Are you using the latest runtime?
-
Escaping UK pound sign in JSON
Der schöne Günther replied to david_navigator's topic in Algorithms, Data Structures and Class Design
Don't experiment and then forget about it. Write some proper unit tests so that they will always be with you and your project. 🧐 -
Escaping UK pound sign in JSON
Der schöne Günther replied to david_navigator's topic in Algorithms, Data Structures and Class Design
None of this should be necessary. Just using a regular TJsonString outputs {"MyString":"The price is £20.00"} {"MyString":"The price is \u00A320.00"} Check: program Project1; uses System.JSON; var LText, LEscapedText: string; LJsonString: TJsonString; LJsonPair: TJsonPair; LJsonObject: TJsonObject; begin LText := 'The price is £20.00'; LJsonString := TJsonString.Create(LText); // Not your subclass TSvJsonString LJsonPair := TJsonPair.Create('MyString', LJsonString); LJsonObject := TJsonObject.Create(LJsonPair); try LEscapedText := LJsonObject.ToString; WriteLn(LEscapedText); LEscapedText := LJsonObject.ToJSON; WriteLn(LEscapedText); finally LJsonObject.Free; end; ReadLn; end. -
Best Practice Question: Bidirectional EXE-to-EXE communication
Der schöne Günther replied to Alexander Halser's topic in RTL and Delphi Object Pascal
Is there a public documentation how one has to implement "AppTethering" to be compatible? Otherwise, it's another vendor-lockin, and you're stuck with Delphi/C++ Builder for implementing both sides. -
Best Practice Question: Bidirectional EXE-to-EXE communication
Der schöne Günther replied to Alexander Halser's topic in RTL and Delphi Object Pascal
I recently did it to extend a Delphi application. The extension was written in C++ and is a regular console application. The Delphi "master" app launches it, sends it commands via stdin and gets result via stdout. It was super easy to test in isolation with a clients machinery because the console app can also be launched and used by a regular ... console window. Would definitely do so again. Not sure if it's a feasible solution if you need to rapidly exchange gargantuan amounts of data. For that, memory mapped files or sockets are probably a better approach. -
Best Practice Question: Bidirectional EXE-to-EXE communication
Der schöne Günther replied to Alexander Halser's topic in RTL and Delphi Object Pascal
There's tons of different IPC mechanisms. What you need depends on your requirements. If you already have the "logic" part in a separate console application, why don't use its stdin/stdout (which are already pipes)? -
Is it possible that an exception does not inherits from Exception class?
Der schöne Günther replied to Wagner Landgraf's topic in RTL and Delphi Object Pascal
That's an interesting approach, never seen it before. 🤔 To this day, I also go with try .. except Rollback; raise; end