Jump to content

Der schöne Günther

Members
  • Content Count

    743
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by Der schöne Günther

  1. Thank you, I am well aware of that. I am not directly accessing any GUI elements from threads. I am invoking events to which a VCL form or frame might be subscribed. Or background event handler might trigger something else that might then update the UI. Similar to like FastMM can throw an access violation at runtime when using memory after it has been freed, I am looking for something that might ~detect~ accessing the VCL in the context of a different thread.
  2. Der schöne Günther

    MacOS and Locking a File

    I cannot contribute how to solve this, but having dealt mostly with Windows I also was surprised recently to find out about how differently this is handled on other platforms like macOS or Linux. Delphi's standard library was initially built for Windows and suggests you could easily enforce this on other platforms as well. For other languages like C++ or Rust, the standard library's file access mechanism don't even support any way "sharing" or "locking". Their default implementation is even "Don't lock anything, allow everything" which I found surprising. Maybe that was just my old Windows habits.
  3. Der schöne Günther

    Delphi 12.3 is available

    I only skimmed through the changelog, but what interests me most is the introduction of an entirely new debugger for Win64: https://docwiki.embarcadero.com/RADStudio/Athens/en/64-bit_IDE#Delphi_Debugger That -could- mean a huge step forward in writing & debugging Delphi code outside of the RAD Studio IDE.
  4. Der schöne Günther

    How to capture a mouse click outside a modal window?

    Can you narrow it down further if the click you want to catch will be Still inside your own application Outside of your application, causing it to lose focus If mouse coordinates matter of you're just interested that a click happened
  5. Der schöne Günther

    Handling Large JSON Responses Efficiently in Delphi

    Not a Delphi library, just a technical article, but still an interesting read, if you have some time: Fast columnar JSON decoding with arrow-rs | Arroyo
  6. Der schöne Günther

    Screenshot a Component

    function TWinControlHelper.CreateBitmap(): TBitmap; var DC: HDC; begin DC := GetWindowDC(Handle); try Result := TBitmap.Create(); try Result.SetSize(Width, Height); BitBlt( Result.Canvas.Handle, 0, 0, Result.Width, Result.Height, DC, 0, 0, WinApi.Windows.SRCCOPY ); except Result.Destroy(); raise; end; finally ReleaseDC(Handle, DC); end; end; I use this... Limited to TWinControl decendants, though...
  7. Der schöne Günther

    TDirectory - file lock out on Win 10 LTSC

    Must feel fantastic to finally have found the cause after three long weeks ( ͡° ͜ʖ ͡°)
  8. Der schöne Günther

    TDirectory - file lock out on Win 10 LTSC

    I've had this with faulty drivers from garbage companies like Intel. Their resource usage is nowhere to be seen in Task Manager, over time, they clearly eat up more and more system resources until the system starts collapsing. Once again, stuff like this is clearly logged in Windows Event Viewer. It might provide additional info.
  9. Der schöne Günther

    pasfmt out now!

    Haven't played around with it much yet. For my taste, turning it on or off via // pasfmt off is a bit to unobtrusive. I think it should stick a bit out more so you immediately see. Something like #[rustfmt::skip] somehow just catches your eye better. Maybe it could also be possible via {$DEFINE NO_FORMAT}? That would also give us syntax highlighting for these parts.
  10. Der schöne Günther

    A few questions about searching and updating JSON Data

    It is a shame your MAILCONFIGS contains an array of objects that just contain another object. Normally, you would use JsonPath for that, but Delphi's JsonPath support is very limited. See: Query JSON documents with JSONPath – grijjy blog System.JSON.TJSONObject.FindValue - RAD Studio API Documentation Quote: "These operators do not support special expressions, they only support actual values (object properties or array indexes)." I am afraid you will have to find the MAILCONFIGS node, and then iterate through it via code.
  11. Der schöne Günther

    Default() and subrange types

    Consider the following code: program Project1; uses System.SysUtils; type TSubRange = 1..10; var subRange: TSubRange; begin subRange := Default(TSubRange); Assert(subRange = Low(TSubRange)); // subRange should be 1, but is 0 end. I was under the impression, that the default value of TSomeRange would be 1 and not 0, a value that can neither be set at compile time, nor at runtime. Documentation of System.Default - RAD Studio API Documentation is non-existent. Documentation about subrange types (Simple Types (Delphi) - RAD Studio) is a bit more helpful: In my case, it doesn't matter whether range checking at runtime is enabled or disabled. Default(TSubRange) seems to gloss over the definition of TSubRange, thinks "Hey, it's a byte" and just outputs 0. My question: - Is this valid behaviour? Has it changed? I am using Delphi 11.1 - Are there possibly any other caveats with subrange types? Maybe just not use them at all?
  12. Der schöne Günther

    A few questions about searching and updating JSON Data

    Did you forget a comma , before your "new_token": or is there really none?
  13. Der schöne Günther

    VCL UI Design Challenge for Delphi Developers 💡

    To me, the form looks like is is that picture, with a transparent "blur" part in the middle. He/she has accomplished the shown part in pure VCL and is, understandably, proud of it. For myself, I am not going to try because I don't see the necessity to use the VCL for this, I would have made it in HTML/CSS. Still, I would be interested how this should ideally be done with good, old VCL.
  14. Der schöne Günther

    VCL UI Design Challenge for Delphi Developers 💡

    I don't understand why there should be a constant recalculation of the "blur" effect. There is a background image, and a small portion of it in the middle has its background blurred. Isn't it always the same part of the image that is blurred? If the window becomes smaller, I would just crop the background image instead of re-scaling it.
  15. Der schöne Günther

    Does anyone know a delphi component that can play videos from a stream

    Maybe just a TWebBrowser (preferably using the Edge/WebView2 engine) is an option?
  16. Der schöne Günther

    LSP Rant

    I haven't really kept up with the latest Delphi versions. Is still still the same problem with the LSP from 2020, or is this something else?
  17. Der schöne Günther

    TDirectory - file lock out on Win 10 LTSC

    Can't you just spin up a fresh VM with the same windows image and see if the problem persists?
  18. Der schöne Günther

    TDirectory - file lock out on Win 10 LTSC

    To me, it sounds more like your application has run out of resources. Not necessarily memory, but probably too many handles, like still opened files. Check Windows Event Viewer for resource exhaustion events and other errors and warnings.
  19. Der schöne Günther

    Introducing TRange<T>

    That's a lot of text and code on your readme page. I must admit I did not read all of it, especially the code. I still have a some questions: Since Delphi cannot put constraints like "can be ordered" or "has an equality operator" on generics, your function seems to work on all types of T. What is the runtime behaviour? For example, what happens when comparing two arbitrary records? Why did you not use DUnit or DUnitX for unit tests and instead rolled your own console application? PS: You committed some unnecessary files (like .exe, .dcu, ...) to your repository. Only the source is necessary. For creating .gitignore files, there are tools like https://gitignore.io/
  20. Der schöne Günther

    looking for a tool suggestion

    It's not my area of expertise, but I'd be sure you won't solve this without a proper browser plugin/extension which may then receive its data from outside. I doubt a simple binary executable from "outside" can reliably do this without breaking with the next browser update.
  21. Der schöne Günther

    Continually Losing Frames

    This also happens with me all the time. There is no method to this madness. When developing with Delphi, I usually spend 10 - 15 % of my time reverting unwanted changes or being extra careful to not commit them. If you are not using any kind of version control, this is clear sign that you should start getting familiar with it now
  22. Der schöne Günther

    Pointer arithmetic question

    Oh sorry, was this a C++ question? In that case, let's add p_int = &2[arr]; std::cout << "p_int points to " << *p_int << std::endl; // 102 to the list, just for fun.
  23. Der schöne Günther

    Pointer arithmetic question

    Make sure the type of your pointer is correct when doing stunts like pointer arithmetic. For example, PInteger when dealing with Integer. Short example: program Project1; var int: Integer; ints: TArray<Integer>; p_int: PInteger; begin int := 42; p_int := Addr(int); WriteLn('p_int points to ', p_int^); // 42 ints := [100, 101, 102]; p_int := Addr(ints[1]); WriteLn('p_int points to ', p_int^); // 101 Inc(p_int); WriteLn('p_int points to ', p_int^); // 102 Inc(p_int); WriteLn('p_int points to ', p_int^); // (some random number) end.
  24. Der schöne Günther

    Edge Webview2 Environment

    I don't know what this is exactly, but you will need the WebView2 runtime from here: https://developer.microsoft.com/de-de/microsoft-edge/webview2/
  25. Der schöne Günther

    How to access/modify underlying records of IList<T>

    IList<T> supports IArrayAccess<T>. Here's an example: procedure p(); type TRecord = record number: Byte; end; begin const items = TCollections.CreateList<TRecord>(); var item := Default(TRecord); item.number := 42; items.add(item); // Replace item at index 0 with a new one var newItem := items[0]; Inc(newItem.number); items[0] := newItem; WriteLn(items[0].number); // or use IArrayAccess<T> var arrayAccess: IArrayAccess<TRecord>; Assert( Supports(items, IArrayAccess<TRecord>, arrayAccess) ); Inc(arrayAccess.Items[0].number); WriteLn(items[0].number); end;
×