Leaderboard
Popular Content
Showing content with the highest reputation on 05/28/25 in all areas
-
CaretPositionRTTIProp.GetValue(Memo1) raises AV
Remy Lebeau replied to dmitrybv's topic in RTL and Delphi Object Pascal
I simply used the debugger at runtime to modify the CallingConvention parameter of the internal System.Rtti.Invoke() function that DoGetValue() calls for a getter method. DoGetValue() is hard-coded to pass in a value of ccReg, I just changed that to ccCdecl instead, and then the AV went away. That is at least a POC that the issue could be fixed if DoGetValue() were made to be more sensitive to the getter's actual RTTI. And likewise for DoSetValue(), too. -
Explore OpenAI Agentic Workflows with File2knowledge
Maxidonkey posted a topic in Tips / Blogs / Tutorials / Videos
Hello all, I recently released File2knowledge on GitHub—a true playground for Delphi developers who want to explore OpenAI via the v1/responses endpoint, perfect for agentic approaches. This project is primarily educational, and here’s why it deserves your attention: Web/Edge UI ready to go: dive in within seconds, no hassle. Session history: replay every experiment, debug model logic, and refine your prompts step by step. Native async: everything’s built on Promises for clean, non-blocking workflows. Mockable architecture: with IoC/DI you can swap out any internal service, simplify your tests, evolve the project… or even switch to FMX if you feel like it. Built-in Assistant File2knowledge goes beyond a simple wrapper: it uses file_search to dig through your source files and the docs of existing GenAI wrappers on GitHub. In practice, you can: Understand a wrapper’s design in detail. Integrate the code directly into your own projects. Customize or fix the base files using vectorized versions of your own technical resources. Turnkey Client Delivered in VCL so you can jump in right away, with a fully modifiable foundation—and an FMX version is coming soon to cover even more platforms. Whenever OpenAI rolls out a new tool (with v1/responses as THE standard for the agentic revolution), I’ll integrate it ASAP so you can test it on the fly. This tool is designed as a hands-on educational lab, but it’s up to you to shape it however you like. I’m all ears for your feedback and suggestions! GitHub : https://github.com/MaxiDonkey/file2knowledge -
At compile time. A simple way is to place the translated file FMX.Const.pas in your project folder or search path.
-
Calling a method of the target form?
-
Fellow Delphi developers, We're pleased to announce the immediate availability of HelpNDoc 9.9, the latest version of our powerful yet easy-to-use help authoring tool. HelpNDoc lets you generate CHM help files, responsive HTML5 and mobile websites, Word and PDF manuals, Markdown documents, ePub and Kindle eBooks, and Qt Help files, all from a single source. This new release introduces several major improvements, including a brand-new Topic Analyzer to help fine-tune individual topics with precision, new table editing tools for moving rows up or down seamlessly, and enhanced script editor functionality such as automatic bracket and quote completion, font ligature support, and updated API methods to streamline scripting tasks. You can explore all the new features in HelpNDoc 9.9 here: https://www.helpndoc.com/news-and-articles/2025-05-27-analyze-topics-in-depth-reorder-tables-with-ease-productivity-enhancements-and-more-in-helpndoc-9.9/ Watch a video overview of some of the new features: HelpNDoc is free for personal use and evaluation. Download the latest version here: https://www.helpndoc.com/download New to HelpNDoc? Our step-by-step video tutorials are a great place to start: Best regards, The HelpNDoc Team https://www.helpndoc.com
-
Why not use Screen.Fonts instead?
-
Getting Windows Sleep message, works for some computers but doesn't work for others.
programmerdelphi2k replied to c0d3r's topic in Windows API
my tests if SHUTDOWN type TForm1 = class(TForm) Memo1: TMemo; BtnDisplayTurnOFF: TButton; procedure BtnDisplayTurnOFFClick(Sender: TObject); private { Private declarations } public // WM_QUERYENDSESSION when MSWindows start the "shutdown" or "restart"... procedure MyWMPowerBroadcastMessage(var AMessage: TMessage); message WM_POWERBROADCAST; end; var Form1: TForm1; implementation {$R *.dfm} const MY_MONITOR_OFF = 2; { TForm1 } procedure TForm1.BtnDisplayTurnOFFClick(Sender: TObject); begin SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, MY_MONITOR_OFF); end; procedure TForm1.MyWMPowerBroadcastMessage(var AMessage: TMessage); begin case AMessage.WParam of PBT_APMQUERYSUSPEND: Memo1.Lines.Add('pc was PBT_APMQUERYSUSPEND at ' + DateTimeToStr(now)); PBT_APMQUERYSTANDBY: Memo1.Lines.Add('pc was PBT_APMQUERYSTANDBY at ' + DateTimeToStr(now)); PBT_APMQUERYSUSPENDFAILED: Memo1.Lines.Add('pc was PBT_APMQUERYSUSPENDFAILED at ' + DateTimeToStr(now)); PBT_APMQUERYSTANDBYFAILED: Memo1.Lines.Add('pc was PBT_APMQUERYSTANDBYFAILED at ' + DateTimeToStr(now)); PBT_APMSUSPEND: Memo1.Lines.Add('pc was PBT_APMSUSPEND at ' + DateTimeToStr(now)); PBT_APMSTANDBY: Memo1.Lines.Add('pc was PBT_APMSTANDBY at ' + DateTimeToStr(now)); PBT_APMRESUMECRITICAL: Memo1.Lines.Add('pc was PBT_APMRESUMECRITICAL at ' + DateTimeToStr(now)); PBT_APMRESUMESUSPEND: Memo1.Lines.Add('pc was PBT_APMRESUMESUSPEND at ' + DateTimeToStr(now)); PBT_APMRESUMESTANDBY: Memo1.Lines.Add('pc was PBT_APMRESUMESTANDBY at ' + DateTimeToStr(now)); // PBTF_APMRESUMEFROMFAILURE: = PBT_APMQUERYSTANDBY // Memo1.Lines.Add('pc was PBTF_APMRESUMEFROMFAILURE at ' + DateTimeToStr(now)); PBT_APMBATTERYLOW: Memo1.Lines.Add('pc was PBT_APMBATTERYLOW at ' + DateTimeToStr(now)); PBT_APMPOWERSTATUSCHANGE: Memo1.Lines.Add('pc was PBT_APMPOWERSTATUSCHANGE at ' + DateTimeToStr(now)); PBT_APMOEMEVENT: Memo1.Lines.Add('pc was PBT_APMOEMEVENT at ' + DateTimeToStr(now)); PBT_APMRESUMEAUTOMATIC: Memo1.Lines.Add('pc was PBT_APMRESUMEAUTOMATIC at ' + DateTimeToStr(now)); PBT_POWERSETTINGCHANGE: Memo1.Lines.Add('pc was PBT_POWERSETTINGCHANGE at ' + DateTimeToStr(now)); else // you're going to want to handle PBT_APMRESUMECRITICAL (XP and older systems) and PBT_APMRESUMEAUTOMATIC differently // IIRC you did not get notification of the suspend in this case Memo1.Lines.Add('pc was <<OTHER NON-REPORTED>> at ' + DateTimeToStr(now)); end; end; end. -
Hmmm. OK. I still have something amiss/NQR. On telling the PC to shutdown with the App running Windows immediately goes to the Shutting down screen. Reminder, I am on a Win 10 PC. This is my full code att.. unit Unit3; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs; type TForm3 = class(TForm) procedure FormShow(Sender: TObject); // private { Private declarations } procedure WMQueryEndSession(var Msg: TWMQueryEndSession); message WM_QueryEndSession; // detect Windows shutdown message procedure SaveData; // routine to save data to disk public { Public declarations } end; function ShutdownBlockReasonCreate(Handle: hWnd; Reason: LPCWSTR): Bool; stdcall; external user32; function ShutdownBlockReasonDestroy(Handle: hWnd): Bool; stdcall; external user32; var Form3: TForm3; DataToBeSaved: Boolean; implementation {$R *.dfm} procedure TForm3.WMQueryEndSession(var Msg: TWMQueryEndSession); begin if DataToBeSaved then begin Msg.Result := lResult(True); // disallow Windows from shutting down SaveData; end; Msg.Result := lResult(False); // allow Windows shutdown end; // Set DataToBeSaved to False after saving data procedure TForm3.FormShow(Sender: TObject); begin DataToBeSaved := True; end; procedure TForm3.SaveData; begin ShutdownBlockReasonCreate(Application.MainForm.Handle, 'please wait while muting...'); // Save data to disk files // ... beep; beep; beep; DataToBeSaved := False; // ShutdownBlockReasonDestroy(Application.MainForm.Handle); end; end. At least it builds now. 😉
-
CaretPositionRTTIProp.GetValue(Memo1) raises AV
Stefan Glienke replied to dmitrybv's topic in RTL and Delphi Object Pascal
Okay, the reason is because the CaretPosition getter is declared as cdecl (I have no clue why that is the case - I would assume some C++ compat because the result is a record) and the code for getting properties does not know about the calling conventions of their setter and getter (because that is not part of their RTTI but only the code pointer to them) and thus always assumes standard calling convention.