

Der schöne Günther
Members-
Content Count
725 -
Joined
-
Last visited
-
Days Won
12
Der schöne Günther last won the day on March 14 2024
Der schöne Günther had the most liked content!
Community Reputation
334 ExcellentTechnical Information
-
Delphi-Version
Delphi 11 Alexandria
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Custom Managed Records Function results: How about Warning: W1048 Unsafe typecast of '%s' to '%s' (Delphi) ?
Der schöne Günther replied to Rollo62's topic in RTL and Delphi Object Pascal
I don't get a warning for the above code at all 🤷♂️ -
Cannot register at German delphipraxis.net!?
Der schöne Günther replied to gsuslb's topic in General Help
Neu bei DP registrieren klappt anscheinend nicht - Delphi-PRAXiS -
xaml island Ask if Embarcadero will integrate UWP & WinUI in comming Version of Radstudio
Der schöne Günther replied to bravesofts's topic in Windows API
Have you considered joining Embarcadero's marketing team? -
xaml island Ask if Embarcadero will integrate UWP & WinUI in comming Version of Radstudio
Der schöne Günther replied to bravesofts's topic in Windows API
Embarcadero has been having too many coals in the fire for years now. Instead of opening the next can of worms, they should be fixing basics like code completion. I remember being in the Microsoft Technology Adoption Program where you got Teams meetings with the developers behind WinUI and other Windows components, got shown not yet released roadmaps and got to ask questions. Back then, it was basically impossible to properly use WinUI outside of Microsoft's Visual Studio (not sure if it was WinUI2 or 3). At that time, they openly replied to me that they had no plans to change that. Except WebView2 has been usable for basically everybody from everywhere, and it's actually good. You can see it being used in a lot of software, not just Microsoft's own products. Just look at how much stuff Microsoft has abandoned in the last couple of years, how much of the "Universal Windows" approach has been dialled down or completely removed already. Not to mention that new GUI stuff has been highly dependant on the most current Windows version. WebView2 even works in Windows 7. I honestly was interested in WinUI around 2018 to 2020 or so, but it certainly never took off. I firmly believe it is not relevant anymore. -
Is there a way to -detect- that the VCL has been accessed from outside of the main thread?
Der schöne Günther replied to Der schöne Günther's topic in RTL and Delphi Object Pascal
Thank you both, that is exactly what I was looking for. 😇 It's a pity the VCL itself uses it just this once but I am sure there were performance considerations. I think this brought me on the right track. I will probably use a TVirtualMethodInterceptor and use the OnBefore hook to watch for methods like ['Repaint', 'Update', 'SetBounds', 'DefaultHandler'] and then call CheckNonMainThreadUsage(). Not sure if it will be sufficient to just use one interceptor on a TForm or TFrame, or if I will need to have a VirtualMethodInterceptors for every kind of control (Buttons, Panels, ...). I will still need to figure that out. 🤔 -
Is there a way to -detect- that the VCL has been accessed from outside of the main thread?
Der schöne Günther replied to Der schöne Günther's topic in RTL and Delphi Object Pascal
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. -
Is there a way to -detect- that the VCL has been accessed from outside of the main thread?
Der schöne Günther posted a topic in RTL and Delphi Object Pascal
I am fully aware that Delphi's VCL interface library exclusively lives in the main thread. Everything VCL related must happen in the main thread. Do not access VCL elements, don't even create and destroy something like a VCL Bitmap or Canvas in a thread. Maybe you don't have to be that cautious, but that's what I remember. Yet, it still occasionally happens to us. An event that used to run in the main thread gets moved to a different thread. Sometimes, things might trigger something that might cause the UI to refresh something. I know that with perfect documentation and more attention this probably wouldn't happen. Yet, it does. My question: Are there any kind of "runtime checks" I can enable to "detect" -anything- from outside the main thread touches the VCL? My motivation is to easier "find" places where the UI layer is accidently accessed from outside of the main thread. -
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.
-
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.
-
How to capture a mouse click outside a modal window?
Der schöne Günther replied to Squall_FF8's topic in FMX
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 -
Handling Large JSON Responses Efficiently in Delphi
Der schöne Günther replied to nolanmaris's topic in Network, Cloud and Web
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 -
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...
-
TDirectory - file lock out on Win 10 LTSC
Der schöne Günther replied to Roger Cigol's topic in General Help
Must feel fantastic to finally have found the cause after three long weeks ( ͡° ͜ʖ ͡°) -
TDirectory - file lock out on Win 10 LTSC
Der schöne Günther replied to Roger Cigol's topic in General Help
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. -
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.